Create a PhoneGap Project for Xcode 4

As of this date, PhoneGap’s templates don’t support Xcode 4. The PhoneGap project has put out a script that works in the meantime, but failed to document a couple of additional steps needed to get a project really working.

Here is what you need to do in order to create a working project:

  1. Download and install the PhoneGap package for iOS as usual.
  2. Download the script from the link above.
  3. (Key Additional Step) Open Xcode 4, go to Preferences…, select the Source Trees tab, and add a Setting Name PHONEGAPLIB, with a path to your PhoneGapLib directory from the installation (usually /Users/username/Documents/PhoneGapLib).
  4. Run the script to create a project.
  5. Open the project in Xcode, select the top-level project in the left-hand pane, select the Build Settings tab, and add i386 to the Valid Architectures setting, so that the simulator version will build (Although I’ve had one project where I needed to do this, and one where I didn’t, so this step may be unnecessary).

Also, the script is a little raw, so don’t use characters in your project name that aren’t valid identifier characters.

Posted in PhoneGap