① sudo npm install -g cordova@6.0.0
② sudo cordova create TestProject com.test.customer TestProject
TestProject: Display Name ,可以更改。
com.test.customer:BundleId,不可以更改。
③cd TestProject
切换到项目目录
④cordova platform add ios@latest
添加IOS平台
⑤安装自己需要的cordova插件
sudo cordova plugin add phonegap-plugin-barcodescanner
sudo cordova plugin add cordova-plugin-device
sudo cordova plugin add cordova-plugin-network-information
sudo cordova plugin add cordova-plugin-battery-status
sudo cordova plugin add cordova-plugin-device-motion
sudo cordova plugin add cordova-plugin-device-orientation
sudo cordova plugin add cordova-plugin-geolocation
sudo cordova plugin add cordova-plugin-camera
sudo cordova plugin add cordova-plugin-globalization
sudo cordova plugin add cordova-plugin-splashscreen
sudo cordova plugin add cordova-plugin-media
sudo cordova plugin add cordova-plugin-file
Xcode中的配置:
①打开Xcode项目 ,点击TestProject --> General --> Deployment Info --> Deployment target(选择自己需要支持的版本)
② 打开项目TestProject --> platforms --> ios --> TestProject- -> 右键新建 Resources文件夹Main.Storyboard.
③选中 Resources文件夹,新建 Main.Storyboard.
④点击TestProject --> General -> Deployment Target - -> Main Interface和 App Icon and Launch Images -> Launch Screen File 选择步骤③中新建的 Main.Storyboard. Devices Orientation:去掉 Landscape Left,Landscape Right的checkbox.
⑤点击TestProject --> Build Setting --> Enable Bitcode选择 No
⑥打开Xcode项目 ,点击TestProject --> Build Setting --> Code Signing Identity --> Debug选择IOS Developer, Release --> 选择IOS Developer
⑦点击TestProject --> Info.plist 添加需要的权限 :
例如 : Privacy - Camera Usage Description ,值 相机;
Privacy - Location When In Use Usage Descriptioin ,值 位置
AppTransport Security Settings -> Allow Arbitrary Loads ,值 YES;
如果上传AppStore 需要添加App Uses Non-Exempt Encryption :no ;
添加 Main storyboard file base name;
⑧运行项目查看是否运行成功。