Reputation: 616
I have a Cordova project which I have opened with Xcode and then emulate from there. Xcode performs a git checkout of the project to a new folder and runs the code from there. However when I run the emulator, it seems to open and older version of my project because it includes a JS debugger which I deleted a long time ago.
When I look at the code in Xcode, it looks correct, but the emulator still runs the old version.
Upvotes: 4
Views: 1325
Reputation: 53301
With cordova 3.X you are not supposed to work with xcode
Even if you are working with xcode, you have to run the cordova prepare ios
command each time you change something.
You can create a script (in xcode select the project, go to build phases, click the + button, and new run script phase). It should be over the copy www phase
The code you need is:
PATH=${PATH}:/usr/local/lib/node_modules/cordova/bin/:/usr/local/bin
cordova prepare ios
EDIT: On Xcode 7 you don't need to add the PATH line, just cordova prepare ios
EDIT2: On Xcode 8 I was getting cordova command not found, I think it uses it's own node version instead of the installed one. In case you have this problem then add Cordova path to your PATH.
As now I use nvm to handle node versions, the path I provided on my answer no longer works for my case.
Best thing to get the path is to type which cordova
in a terminal window, you'll get the Cordova path, something like: /Users/username/.nvm/versions/node/v4.4.7/bin/cordova
.
Add that path without the cordova part to your build script before the cordova prepare ios, something like
PATH=/Users/username/.nvm/versions/node/v4.4.7/bin/:$PATH && cordova prepare ios
Upvotes: 5