一.先安装node
二.cordova安装,建demo
➜ ~ git:(master) ✗ sudo npm install -g cordova Password: /usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordova [email protected] /usr/local/lib/node_modules/cordova ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ([email protected]) ├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) └── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) ➜ ~ git:(master) ✗ cd Desktop ➜ Desktop git:(master) ✗ cordova create hello com.example.hello HelloWorld Creating a new cordova project. ➜ Desktop git:(master) ✗ cd hello ➜ hello git:(master) ✗ cordova platforms add ios Adding ios project... Running command: /Users/goyoo/.cordova/lib/npm_cache/cordova-ios/3.9.2/package/bin/create /Users/goyoo/Desktop/hello/platforms/ios com.example.hello HelloWorld --cli iOS project created with [email protected] Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the project Fetching plugin "cordova-plugin-whitelist@1" via npm Installing "cordova-plugin-whitelist" for ios This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in. ➜ hello git:(master) ✗ cordova platforms add android Adding android project... Running command: /Users/goyoo/.cordova/lib/npm_cache/cordova-android/4.1.1/package/bin/create /Users/goyoo/Desktop/hello/platforms/android com.example.hello HelloWorld --cli Creating Cordova project for the Android platform: Path: platforms/android Package: com.example.hello Name: HelloWorld Activity: MainActivity Android target: android-22 Copying template files... Android project created with [email protected] Installing "cordova-plugin-whitelist" for android This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
三.用framework7 框架 建一个ios app
1.建一个cordova 项目
➜ tab-bar git:(master) ✗ cordova create app Creating a new cordova project.
2.删除app/www 下面的四个文件
3.复制一个h5 项目到app/www 文件夹下,打开www/index.html 添加<script type="text/javascript" src="cordova.js"></script>
4.
➜ app git:(master) ✗ cordova platforms add ios Adding ios project... Running command: /Users/goyoo/.cordova/lib/npm_cache/cordova-ios/3.9.2/package/bin/create /Users/goyoo/Downloads/Framework7-1.4.0/examples/tab-bar/app/platforms/ios io.cordova.hellocordova HelloCordova --cli iOS project created with [email protected] Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the project Fetching plugin "cordova-plugin-whitelist@1" via npm Installing "cordova-plugin-whitelist" for ios This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
5.进platforms/ios,就可以用Xcode打开.xcodeproj项目了
6.已有H5项目 ,同上,index.html 加<script type="text/javascript" src="cordova.js"></script>
➜ Desktop git:(master) ✗ cd app-ui-h5.git ➜ app-ui-h5.git git:(master) ✗ cordova platforms add ios Adding ios project... Running command: /Users/goyoo/.cordova/lib/npm_cache/cordova-ios/3.9.2/package/bin/create /Users/goyoo/Desktop/app-ui-h5.git/platforms/ios com.xiaoyun.wdsj 旺店商家 --cli iOS project created with [email protected] Running command: /Users/goyoo/Desktop/app-ui-h5.git/hooks/after_prepare/010_add_platform_class.js /Users/goyoo/Desktop/app-ui-h5.git add to body class: platform-ios Installing "com.goyoo.report" for ios Installing "com.ionic.keyboard" for ios Notice: org.apache.cordova.camera has been automatically converted to cordova-plugin-camera and fetched from npm. This is due to our old plugins registry shutting down. Fetching plugin "cordova-plugin-camera" via npm cordova-plugin-camera" will not install due to "/Users/goyoo/Desktop/app-ui-h5.git/plugins/org.apache.cordova.camera" being installed. Installing "org.apache.cordova.camera" for ios Notice: org.apache.cordova.console has been automatically converted to cordova-plugin-console and fetched from npm. This is due to our old plugins registry shutting down. Fetching plugin "cordova-plugin-console" via npm cordova-plugin-console" will not install due to "/Users/goyoo/Desktop/app-ui-h5.git/plugins/org.apache.cordova.console" being installed. Installing "org.apache.cordova.console" for ios Notice: org.apache.cordova.device has been automatically converted to cordova-plugin-device and fetched from npm. This is due to our old plugins registry shutting down. Fetching plugin "cordova-plugin-device" via npm cordova-plugin-device" will not install due to "/Users/goyoo/Desktop/app-ui-h5.git/plugins/org.apache.cordova.device" being installed. Installing "org.apache.cordova.device" for ios Notice: org.apache.cordova.file has been automatically converted to cordova-plugin-file and fetched from npm. This is due to our old plugins registry shutting down. Fetching plugin "cordova-plugin-file" via npm cordova-plugin-file" will not install due to "/Users/goyoo/Desktop/app-ui-h5.git/plugins/org.apache.cordova.file" being installed. Installing "org.apache.cordova.file" for ios Notice: org.apache.cordova.file-transfer has been automatically converted to cordova-plugin-file-transfer and fetched from npm. This is due to our old plugins registry shutting down. Fetching plugin "cordova-plugin-file-transfer" via npm cordova-plugin-file-transfer" will not install due to "/Users/goyoo/Desktop/app-ui-h5.git/plugins/org.apache.cordova.file-transfer" being installed. Installing "org.apache.cordova.file-transfer" for ios Notice: org.apache.cordova.file has been automatically converted to cordova-plugin-file and fetched from npm. This is due to our old plugins registry shutting down. Fetching plugin "cordova-plugin-file" via npm cordova-plugin-file" will not install due to "/Users/goyoo/Desktop/app-ui-h5.git/plugins/org.apache.cordova.file" being installed. Dependent plugin "org.apache.cordova.file" already installed on ios. Notice: org.apache.cordova.geolocation has been automatically converted to cordova-plugin-geolocation and fetched from npm. This is due to our old plugins registry shutting down. Fetching plugin "cordova-plugin-geolocation" via npm - / | | \ cordova-plugin-geolocation" will not install due to "/Users/goyoo/Desktop/app-ui-h5.git/plugins/org.apache.cordova.geolocation" being installed. Installing "org.apache.cordova.geolocation" for ios Notice: org.apache.cordova.network-information has been automatically converted to cordova-plugin-network-information and fetched from npm. This is due to our old plugins registry shutting down. Fetching plugin "cordova-plugin-network-information" via npm cordova-plugin-network-information" will not install due to "/Users/goyoo/Desktop/app-ui-h5.git/plugins/org.apache.cordova.network-information" being installed. Installing "org.apache.cordova.network-information" for ios