In order to start to develop apps for iOS devices it's mandatory to have a Mac and to download the iOS SDK and Xcode, both available on the Apple Developer Center
http://developer.apple.com. Complete the following steps and if you are using PhoneGap 2.0 run the installer Cordova-2.0.0.pkg
available after mounting the Cordova-2.0.0 DMG
file locate into the folder /phonegap-phonegap-2.0.0/lib/ios
:
Once everything is installed navigate to the bin/ios
folder of the current PhoneGap installation and launch the ./create
tool:
$ cd PHONEGAP_ROOT/lib/android/bin $ ./create ~/the/path/to/your/source/code/ch01/ios com.gnstudio.samples.cordova.hello HelloPG
In the target folder you'll find the file HelloPG.xcodeproj
; when you open the file in Xcode, your project is already set up and ready to be debugged and deployed.
Tip
If you are using a PhoneGap version greater than the 2.0.0 there is no need to mount the mentioned DMG file in the PHONEGAP_ROOT
folder. In order to create a project, is enough to go to the PHONEGAP_ROOT/lib/ios/bin
folder and run the ./create
tool or use the cordova command line utility available as a npm module.
In order to debug the app change the Target in the Scheme drop-down menu on the toolbar to HelloPG (or the current project name) and change the Active SDK in the Scheme drop-down menu on the toolbar to iOS [version] Simulator.
To deploy the app on a physical device: open the file HelloPG-Info.plist
; under the Resources
group, change BundleIdentifier
to the identifier provided by Apple; change the Target in the Scheme drop-down menu on the toolbar to HelloPG
(or the current project name); and, with the device connected through USB, click on the Run button in the project window's toolbar.
Note
If you are searching a tool for Objective-C with advanced refactoring features, a better code completion, a great support for Unit tests and powerful code inspection tool you have to consider to buy AppCode from JetBrains , more information is availabl e at http://www.jetbrains.com/objc/.