博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
cordova(PhoneGap)简单应用
阅读量:7227 次
发布时间:2019-06-29

本文共 7377 字,大约阅读时间需要 24 分钟。

一.先安装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

  

 

转载于:https://www.cnblogs.com/-yfan/p/5070102.html

你可能感兴趣的文章
springMvc学习笔记(2)
查看>>
吐槽Javascript系列二:数组中的splice和slice方法
查看>>
什么是Javascript函数节流?
查看>>
MQ框架的比较
查看>>
oschina
查看>>
Octave 入门
查看>>
深度学习入门:10门免费线上课程推荐
查看>>
React组件设计模式(一)
查看>>
E-HPC支持多队列管理和自动伸缩
查看>>
express + mock 让前后台并行开发
查看>>
30天自制操作系统-2
查看>>
小程序开发之路(一)
查看>>
Odoo domain写法及运用
查看>>
JavaScript工作原理(五):深入了解WebSockets,HTTP/2和SSE,以及如何选择
查看>>
猫头鹰的深夜翻译:Java 2D Graphics, 简单的仿射变换
查看>>
面试题:给你个id,去拿到name,多叉树遍历
查看>>
go append函数以及写入
查看>>
关于Java中分层中遇到的一些问题
查看>>
配置 PM2 实现代码自动发布
查看>>
android百种动画侧滑库、步骤视图、TextView效果、社交、搜房、K线图等源码
查看>>