Chapter 13. Other Native Platforms

If you want to build applications for the iPhone and the iPod touch that will be sold on the App Store, alternatives are available to the traditional Objective-C and Cocoa Touch route. Development platforms now exist allowing JavaScript and C# developers to get direct access to the iPhone’s hardware features, such as the accelerometer.

PhoneGap

PhoneGap, developed by Nitobi, is an open source development platform for building cross-platform mobile applications with JavaScript.

On the iPhone, it works by providing a prebuilt library containing Objective-C classes that wrap the iPhone’s native capabilities (e.g., vibration and accelerometer support) and exposes these capabilities to JavaScript along with an Xcode project template that makes use of the library. You can then compile your application as a hybrid of native Objective-C and JavaScript inside Xcode.

The platform is device-agnostic, allowing you to build an application for the iPhone, Android, and BlackBerry devices simultaneously. Developing applications using the PhoneGap framework is a reasonable alternative to building all-native applications in Objective-C.

In the past, submitting to the App Store applications built around the PhoneGap platform was problematic. However, since the 0.8.0 release, this has been resolved and Apple has approved PhoneGap for building applications intended for the store.

Note

Since the 0.8.0 release, the PhoneGap platform has embedded a version tag into the compiled ...

Get Learning iPhone Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.