Reputation: 15993
I use Cordova/PhoneGap to create an iOS app. During development, I do changes to HTML/CSS/JS files in www
folder and thus have to rebuild regularly. I usually do this on my Mac:
cordova prepare
CMD
+ tab
to switch to XcodeCMD
+ 'R' to run the app on my attached iPhoneThis works but it's a little annoying to repeat these steps all the time. Is there a way to speed this up, e.g. by creating a shell script that automagically does all these steps?
Upvotes: 1
Views: 1233
Reputation: 15993
I found the best solution for me. First, I installed ios-deploy
via npm:
$ npm install -g ios-deploy --unsafe-perm=true
Then I simply run this for iOS for example:
$ cordova run ios --device
The run
command will internally automatically call prepare
and thus copy the content of www
and then launch the app on the device.
Upvotes: 0
Reputation: 53341
Sure, on xcode go to "Build Phases", press the + button and select "New Run Script Phase".
Move it to be over the "Copy www directory"
And use this code:
cordova prepare ios
EDIT: Is for some reason you can't move the new script over the "Copy www directory" one, I've found another way that will work.
Just open the "Copy www directory" (it's a build script too) and add the cordova prepare ios
before the existing code
Upvotes: 1