Phonegap has changed its name to Cordova since it was donated to the Apache Foundation, and the stable version is 2.6.0 at the time of publication.

 

Apache Cordova provides a way to use Web technologies to develop Mobile applications. It supports 10 Android, IOS, Windows Phone, and Blackberry applications. The Javascript API allows Web applications to access various features of the device. Here’s how to use it to develop iOS applications.

 

Necessary conditions:

Mac OS X (10.7.4+), Xcode 4.5, iOS6 SDK, Xcode command line tool, and iOS devices.

 

Install Cordova:

Download the latest version of Phonegap here. I downloaded 2.6.0. Decompress the package after downloading it.

 

Create project:

In earlier versions of Phonegap, a DMG installation package was provided, which added a Phonegap project template to Xcode. The new 2.6.0 uses command line creation instead of this approach.

After unpacking, we can see a number of * platform types in the lib directory, go to ios and use Terminal to go to the bin directory.

  

Perform:

./create ~/Documents/ProjectDestination/Helloworld cn.blogs.cocowool HelloWorld

 

The command has three main parameters:

1. Project Location The path created by the create method will be saved in this path.

2. Package Name

3. Project Name

 

Optional parameters:

Using the default way to create a project will copy the necessary library files from Cordorva’s release folder to your project folder. It is stored in the CordovaLib directory. But some developers prefer to share a single CordovaLib across multiple projects, so that all projects are updated when the Lib is updated. With the –share parameter, CordovaLib can be used as a soft link to the create location.

 

Execution procedure:

Using Finder to locate the project directory, double-click helloWorld.scodeproj to open the project in Xcode. The default emulator is iPad, change it to the emulator you need. Command + R to run the project:

 

 

 

Now, we can use Cordorva API to edit files in the WWW directory, to achieve their desired functions.

 

 

References:

1. Getting Started with iOS

2. Baidu Encyclopedia Phonegap