标签:
一.先安装node
二.cordova安装,建demo
? ~ git:(master) ? sudo npm install -g cordova Password: /usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordova cordova@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 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 cordova-ios@3.9.2 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 cordova-android@4.1.1 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 cordova-ios@3.9.2 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 cordova-ios@3.9.2 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
标签:
原文地址:http://www.cnblogs.com/-yfan/p/5070102.html