Getting Started With Phonegap For iOS
npm install --global phonegap
phonegap create hello com.example.hello HelloWorld
phonegap build ios
Note: In step two, the first
hello is the name of the folder to create the app in. The
com.example.hello is basically just another name for your app, so change the
hello portions to whatever you like. The
HelloWorld at the very end of the command designates the app name (I think), so call it whatever you like (without spaces).
To run the app in the iOS emulator:
phonegap run ios --emulator
run command will do
build for you, but if you don't want to instantly run the app in the simulator then use
If the iOS simulator node module isn't installed already (it's probably not), then you will need to install it. This is supposed to be automatic, but my copy of Phonegap threw an error for some reason. I this happens just install it manually:
npm install --global ios-sim
The documentation for Phonegap is seriously out of date, and it doesn't ever seem to distinguish between Cordova and Phonegap in a meaningful way.
The info on this page is decent for getting started.
Running on an iPhone or iPad (With a Developer Account)
Make sure your iPhone or iPad is connected via USB and then run:
phonegap run ios --device
This, as with deploying to the simulator is supposed to work automatically out of the box but it also gave me problems when trying to install the necessary dependency, ios-deploy. If you get errors, as above just install manually:
npm install --global ios-deploy
Now you should be able to run your app on iOS :)
Note: For the above to work you do need to have an Apple developer account and have already set up your devices for development... or just follow the instructions below.
Running on a Jailbroken Device without a Developer Account
- Install AppSync through Cydia. Your jailbroken device should already have Cydia, but in Cydia you probably don't have access to AppSync by default. You will need to add an external Cydia repo that has AppSync. Add one of the repos from this page on installing AppSync.
- Download and install Jailcoder.
- Open Jailcoder and hit the big button to do a guided install.
That's all, now you can enjoy testing apps on a real device without the need for an apple developer account. That being said, if you want to publish your apps to the App Store you will need a developer account. But $99 per year is probably well worth it if you're going to be publishing apps. Enjoy!