1.安装phoneGap
sudo npm install -g phonegap
2.创建app框架
cd /Users/shuly/Desktop/Test
phonegap create my-app
3.创建iOS分支
cd /Users/shuly/Desktop/Test/my-app/platforms
phonegap local build iOS
1.$ sudo npm install -g
cordova
2.$ cordova create hello com.example.hello HelloWorld
3. $ cd hello
4.
$ cordova platform add amazon-fireos
$ cordova platform add android
$ cordova platform add blackberry10
$ cordova platform add firefoxos
$ cordova platform add iOS
4.Run the following command to iteratively build the project:
$ cordova build
This generates platform-specific code within the project‘s platforms
subdirectory. You can optionally limit the scope of each build to
specific platforms:
$ cordova build ios
The cordova build
command is a shorthand for the following, which in this example is also targeted to a single platform:
$ cordova prepare ios
$ cordova compile ios
In this case, once you run prepare
, you can use Apple‘s Xcode SDK as an alternative to modify and compile the platform-specific code
that Cordova generates within platforms/ios
. You can use the same approach with other platforms‘ SDKs.
Test the App on an Emulator or Device
SDKs for mobile platforms often come bundled with emulators that execute a device image, so that you can launch the app from the home screen and see how it interacts with many platform features. Run a command such as the following to rebuild the app and view
it within a specific platform‘s emulator:
$ cordova emulate android
Some mobile platforms emulate a particular device by default, such as the iPhone for iOS projects. For other platforms, you may need to first associate a device with an emulator.