iOS Application changes doesn't update ionic 2 on mac

Hi All,

I started to develop ionic 2 cordova app on mac and doesn’t update ios Application.
My pc specs are,

node v8.9.1
npm v5.5.1
cordova v7.1.0
ionic v3.17.0
editor VSCode

if I want some code change in ionic-v1 then I can edit platform -> ios -> www ->.js files or platform -> ios -> www ->.html files and reload xcode then changes appear on real device.

But in ionic 2 app platform -> ios -> www folder contain minified files and cannot edit these files. so I follow this process but code doesn’t change.

  1. Add ios platform to project using cordova platform add ios and run ios app on xcode. initial app runs fine
  2. then go to project -> src -> pages ->home ->home.component.ts edit home.component.ts and home.component.html
  3. run cordova prepare to add changes to ios platform
  4. stop xcode and clean->build->run project again… changes doesn’t appear.
  5. remove ios platform using cordova platform remove ios and readd it using cordova platform add ios then new changes are appear.

I develop ionic-v1 and ionic 2 apps on windows and those are working perfectly on device.
what is the correct procedure to develop ionic 2 app on mac and dedug it correctly.
any help could be appreciated.
Thank you.

First of all, there’s a big difference in how you should edit files between the different versions. DO NOT edit your www folder anywhere in your Ionic2 project! This folder contains automatically generated output. Just edit the files under src. Also DO NOT (unless absolutely necessary for some reason) tamper with files in your platform folder, since these files are also generated automatically when hitting specific commands.

What you should do: edit your app under src. Just serve the app to your browser to see changes being applied. If you want to build for ios and you’ve added the platform, simply runionic cordova build ios to create a build which you can debug. Now you will see the changes in your xcode project. No need to clean, platform remove etc. You can also run it with ionic cordova run ios --livereload.

Hi luukschoen thank you for quick reply.

Of cause I can run ionic serve and changes are appear correctly. but here I need run app on device. because in my app I use device camera, device storage ect. In ionic-v1 I can change code in xcode and see my changes in xcode. in ionic v1 I usually do,

  1. start app project -> platform -> ios -> .MyApp.xcodeproj on xcode and run it on my iPhone
  2. start safari and inspect using safari -> Develop -> iPhone and debug here and do changes

In ionic 2 I cannot see any typeScript code. all of them are minified js and minified files there.
the problem is how why my changes in under src doesn’t appear on real device. also when I run app on my iPhone and go to safari -> Develop -> iPhone under Resource tab my new changes doesn’t appear.
Did I do it wrong…? what is the missing step here…?

Please note that I’m facing this issue in ionic 2

Yes I’m aware of the fact you’re using Ionic2, hence the explanation for Ionic2. Thank you. What commands are you using when building for ios?

:wink: I just remind it. After edit files under src I tried,

  1. run cordova prepare then cordova build ios after that stop xcode and clean->build->run project again.
  2. run ionic cordova prepare ios then ionic cordova build ios after that stop xcode and clean->build->run project again.
    But no luck for both ways :frowning: new changes doesn’t appear.

Try after remove platform and re-add the platform

it works, but it is not a solution, then after every change need to remove platform and re-add it.

Any updates? Same problem here!

I am updating code as below :

  1. Open project in xcode and then
    change in staging>www folder

  2. simple give following command
    ionic cordova prepare ios (for ionic version > 2)
    ionic prepare ios