David Schumann
David Schumann

Reputation: 14793

Xcode does not include changes in rebuild of cordova app

I am experiencing the problem that Xcode does not incorporate any changes made to HTML/CSS/JS files when rebuilding the app for iOS

Right now I am deleting the whole platforms/ios folder and rerunning cordova add platform ios every time. This can't be the intended way of testing cordova apps. What is a good workflow for testing cordova apps on an iOS device?

Upvotes: 2

Views: 2277

Answers (2)

Mali
Mali

Reputation: 671

Try ionic cordova prepare ios.

Upvotes: 0

jcesarmobile
jcesarmobile

Reputation: 53301

Well, the recommended workflow for testing Cordova apps is not using Xcode at all, just use the Cordova CLI to run your apps. But the truth is that running from the CLI might be slower than using Xcode.

What you need to copy the changes from www to the Xcode project is to run cordova prepare ios before running from Xcode. You can do it manually or create a Xcode build script to run it for you.

To add a build script, on Xcode select your project target, go to Build Phases, click the + button and select New Build Script phase. You can try to just add cordova prepare ios and this might work.

If you get a cordova command not found, then you also need to add Cordova path to your PATH. To do it, open a terminal and type which cordova, you'll get the Cordova path, something like /Users/davidnathan/.nvm/versions/node/v4.4.7/bin/cordova. Now add that path without the cordova part to your build script before the cordova prepare ios, something like

PATH=/Users/davidnathan/.nvm/versions/node/v4.4.7/bin/:$PATH && cordova prepare ios

Move the build script to be over the existing "Copy www directory"

Upvotes: 5

Related Questions