一.先安装node
二.cordova安装,建demo
➜ ~ git:(master) ✗ sudo npm install -g cordovaPassword:/usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordovacordova@5.4.1 /usr/local/lib/node_modules/cordova├── ansi@0.3.0├── underscore@1.7.0├── q@1.0.1├── nopt@3.0.1 (abbrev@1.0.7)├── update-notifier@0.5.0 (is-npm@1.0.0, semver-diff@2.1.0, chalk@1.1.1, string-length@1.0.1, repeating@1.1.3, configstore@1.4.0, latest-version@1.0.1)└── cordova-lib@5.4.1 (valid-identifier@0.0.1, opener@1.4.1, properties-parser@0.2.3, semver@4.3.6, shelljs@0.3.0, nopt@3.0.6, dep-graph@1.1.0, cordova-app-hello-world@3.10.0, glob@4.0.6, xcode@0.8.0, npmconf@2.1.2, rc@0.5.2, tar@1.0.2, npm@2.14.15, request@2.47.0, aliasify@1.8.0, init-package-json@1.9.1, cordova-serve@1.0.0, cordova-js@4.1.2)➜ ~ git:(master) ✗ cd Desktop➜ Desktop git:(master) ✗ cordova create hello com.example.hello HelloWorldCreating a new cordova project.➜ Desktop git:(master) ✗ cd hello➜ hello git:(master) ✗ cordova platforms add iosAdding 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 --cliiOS project created with cordova-ios@3.9.2Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the projectFetching plugin "cordova-plugin-whitelist@1" via npmInstalling "cordova-plugin-whitelist" for iosThis 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 androidAdding 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 --cliCreating Cordova project for the Android platform: Path: platforms/android Package: com.example.hello Name: HelloWorld Activity: MainActivity Android target: android-22Copying template files...Android project created with cordova-android@4.1.1Installing "cordova-plugin-whitelist" for androidThis 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 appCreating a new cordova project.
2.删除app/www 下面的四个文件
- css folder
- img folder
- js folder
- index.html file
3.复制一个h5 项目到app/www 文件夹下,打开www/index.html 添加<script type="text/javascript" src="cordova.js"></script>
4.
➜ app git:(master) ✗ cordova platforms add iosAdding 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 --cliiOS project created with cordova-ios@3.9.2Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the projectFetching plugin "cordova-plugin-whitelist@1" via npmInstalling "cordova-plugin-whitelist" for iosThis 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 iosAdding 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 旺店商家 --cliiOS project created with cordova-ios@3.9.2Running command: /Users/goyoo/Desktop/app-ui-h5.git/hooks/after_prepare/010_add_platform_class.js /Users/goyoo/Desktop/app-ui-h5.gitadd to body class: platform-iosInstalling "com.goyoo.report" for iosInstalling "com.ionic.keyboard" for iosNotice: 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 npmcordova-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 iosNotice: 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 npmcordova-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 iosNotice: 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 npmcordova-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 iosNotice: 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 npmcordova-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 iosNotice: 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 npmcordova-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 iosNotice: 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 npmcordova-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 iosNotice: 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 npmcordova-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