經常使用語句。html
安裝好後, node
1. 生成 APP 腳本, cordova run android。 和cordova emulate android
前提:
You need the iOS SDK installed on your computer to build an iOS version of your application using the steps below.android
On the command line, make sure you are in the workshop directory and type:ios
cordova build ios
The project is built in the workshop/platforms/ios folder. Double-click Workshop.xcodeproj to open the project in Xcode, and run it in the emulator or on your device.git
You can also run the application in the iOS emulator directly from the command line. First install ios-sim:github
npm install -g ios-sim
orapache
sudo npm install -g ios-sim
Then run the application in the iOS emulator:npm
cordova emulate ios
Make sure you have an up-to-date version of Node.js installed on your system.xcode
Open Terminal (Mac) or a Command window (Windows), and type the following command to install the Cordova CLI:app
npm install -g cordova
or on a Mac:
sudo npm install -g cordova
If you already have Cordova installed on your computer, make sure you upgrade to the latest version:
npm update -g cordova
or
sudo npm update -g cordova
Navigate (cd) to a directory where you store projects on your file system.
Using the Cordova CLI, create a Cordova project named Workshop in a directory named workshop:
cordova create workshop com.yourname.workshop Workshop
Navigate to the project directory:
cd workshop
Add support for the iOS platform (optional)
To be able to build for the iOS platform, the iOS SDK must be installed on your system. If it's not, you can skip this step and add support for another platform, or simply run the tutorial application in your browser.
On the command line, make sure you are in the workshop directory and type:
cordova platforms add ios
Add support for the Android platform (optional)
To be able to build for the Android platform, the Android SDK must be installed on your system. If it's not, you can skip this step and add support for another platform, or simply run the tutorial application in your browser.
On the command line, make sure you are in the workshop directory and type:
cordova platforms add android
Make sure you are in the workshop directory, and add basic plugins to your projects:
cordova plugin add org.apache.cordova.device
cordova plugin add org.apache.cordova.console
Examine the directory structure under workshop.