Getting started with iOS and Xcode

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:

  • Install Xcode from the App Store.
  • Install the Xcode command-line tools (Xcode Preferences | Downloads | Components | Command Line Tools | Install).

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.

Getting started with iOS and Xcode

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.

Getting started with iOS and Xcode

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 available at http://www.jetbrains.com/objc/.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.184.90