iOS builds old files and livereload doesn't work

I did all steps to run ionic app on iOS.
I have Xcode 8 and it runs my app but it runs old code, it doesn’t run latest code. When it runs it, livereload doesn’t work, on phone and emulator.

What I did is:

ionic cordova preapre ios
ionic cordova emulate ios -lc

Also I tried
ionic cordova run ios -lc

It builds my app, but some old version and live reload doesn’t work. I cleaned my project via Xcode, the same problem remains. It works fine on android and browser

Remove the ios platform, re-add it. Then run the emulate command.

1 Like

I’ve tried that already couple of times. I even tried

ionic cordova platform rm ios
ionic cordova platform add ios@latest

So it runs old code even though you deleted the folder where the code it runs is located?
What exactly are you doing in Xcode?
What do you see when you run ionic serve?

For ionic serve it’s working just fine. I checked main.js inside platforms folder and it seems that code is updated but it doesn’t acts like it should, like it doesn’t read that code at all.

Also live reload doesn’t work at all.

I#m only building an app via Xcode, nothing else

Hmm.

Do you use Ionic Deploy or another similar live deploy feature?

Can you try with a new project created with ionic start?

Also post your ionic info output please.

cli packages: (/Users/user/Desktop/mimic-hybrid/node_modules)

    @ionic/cli-utils  : 1.12.0
    ionic (Ionic CLI) : 3.12.0

global packages:

    cordova (Cordova CLI) : 7.0.1 

local packages:

    @ionic/app-scripts : 1.3.12
    Cordova Platforms  : ios 4.5.1
    Ionic Framework    : ionic-angular 3.5.0

System:

    ios-deploy : 1.9.2 
    ios-sim    : 6.1.2 
    Node       : v6.11.3
    npm        : 5.4.2 
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.3 Build version 8E3004b 

Misc:

    backend : pro

It’s working on this new app but not mine. hmm that’s weird

This is old. Update it.

Thanks but it doesn’t work

What doesn’t work? Updating? Why?

It updates the app-scripts just fine, but my app still hangs on the same code, doesn’t update my code and livereload doesn’t work

Does it work without -lc, so just a proper emulate?

It builds the app but still it uses some old code. It’s different from ionic serve

Please post the complete output of ionic cordova emulate ios --verbose and confirm it shows unexpected data.

Here it is https://justpaste.it/1c26r

Hm, couldn’t find anything wrong.

Are you sure the simulator is running the current app and not an old version? Did you uninstall it before or reset the simulator?

What I realized is that I have to remove files from DerivdData because that’s where Xcode caches files and also clean project. Then I have to do ionic cordova prepare

But again livereload doesn’t work

Ok, so the “old files” problem is solved?

What is your ionic info now?

Now every time I dome some change I run ionic serve so my www folder is updated. Then I run ionic cordova prepare so it transfer www folder to platforms/ios. I don’t even have to clean project or delete DerivedData

ionic info:

cli packages: (/Users/user/Desktop/mimic-hybrid/node_modules)

    @ionic/cli-utils  : 1.12.0
    ionic (Ionic CLI) : 3.12.0

global packages:

    cordova (Cordova CLI) : 7.0.1 

local packages:

    @ionic/app-scripts : 3.0.0
    Cordova Platforms  : ios 4.4.0
    Ionic Framework    : ionic-angular 3.5.0

System:

    ios-deploy : 1.9.2 
    ios-sim    : 6.1.2 
    Node       : v6.11.3
    npm        : 5.4.2 
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.3 Build version 8E3004b 

Misc:

    backend : pro
1 Like

ionic cordova run ios should build the Ionic project, then copy the files and build the native project all in one command.