热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

iOS开发之PhoneGap

最近网上搜了一些资料,以前版本的有个安装包,但是最新的版本没有了,他是通过命令行安装并且创建App的,我主要是看的他的文档来

最近网上搜了一些资料,以前版本的有个安装包,但是最新的版本没有了,他是通过命令行安装并且创建App的,我主要是看的他的文档来设置的,呵呵!

这有是我搜到的一些资料:


PhoneGap 2.7 iOS配置安装详细教程


http://www.tuicool.com/articles/7RbURv


Xcode5 + PhoneGap 2.9搭建iOS开发环境-配置-测试-归档上传

http://my.oschina.net/jgy/blog/168745


PhoneGap的介绍

http://blog.sina.com.cn/s/blog_4cdc44df0100uuiq.html



下面是下载地址:

http://phonegap.com/install/



The Cordova Command-line Interface

This guide shows you how to create applications and deploy them tovarious native mobile platforms using thecordova command-lineinterface (CLI). This tool allows you to create new projects, buildthem on different platforms, and run them within an emulator. You canalso use the CLI to initialize project code, after which you usevarious platforms' IDEs to develop them further.


Prerequisites

Before running any command-line tools, you need to install SDKs foreach platform you wish to target.

To add support or rebuild a project for any platform, you need to runthe command-line interface from the same machine that supports theplatform's SDK. The CLI supports the following combinations:


  • iOS (Mac)
  • Android (Mac, Linux)
  • Blackberry (Mac, Windows)
  • Windows Phone 7 (Windows)
  • Windows Phone 8 (Windows)

On the Mac, the command-line is available via the Terminalapplication. On the PC, it's available asCommand Prompt underAccessories.

The more likely it is that you run the CLI from different machines,the more it makes sense to maintain a remote source code repository,whose assets you pull down to local working directories.

To install the cordova command-line tool, follow these steps:


  1. Download and install Node.js. Followinginstallation, you should be able to invoke node ornpm on yourcommand line.

  2. Install the cordova utility. In Unix, prefixing the additionalsudo command may be necessary to install development utilities inotherwise restricted directories:

    $ sudo npm install -g cordova

    The installation log may produce errors for any uninstalledplatform SDKs. Following installation, you should be able to runcordova on the command line.

  3. To ensure permissions are correct, run this command on Mac orLinux, changing LOGIN to match your account name:

    $ sudo chown -R LOGIN /usr/local/lib/node_modules/cordova

After installing the cordova utility, you can always update it tothe latest version by running the following command:

    $ sudo npm update -g cordova

Use this syntax to install a specific version:

    $ sudo npm install -g cordova@2.8.0

Run the info command for a listing that includes the current versionalong with other available version numbers:

    $ npm info cordova

Create an App

Go to the directory where you maintain your source code, and run acommand such as the following:

    $ cordova create HelloWorld com.example.hello "Hello World"

The first argument specifies a HelloWorld directory to be generatedfor your project. Itswww subdirectory houses your application'shome page, along with various resources undercss, js, and img,which follow common web development file-naming conventions. Theconfig.xml file contains important metadata needed to generate anddistribute the application.

The other two arguments are optional: the com.example.hello argumentprovides your project with a reverse-domain-style identifier, and the"Hello World!" provides the application's display text. You can editboth of these values later in the config.xml file.


Add Platforms

All subsequent commands need to be run within the project's directory,or any subdirectories within its scope:

    $ cd HelloWorld

Before you can build the project, you need to specify a set of targetplatforms. Your ability to run these commands depends on whether yourmachine supports each SDK, and whether you have already installed eachSDK. Run any of these from a Mac:

    $ cordova platform add ios$ cordova platform add android$ cordova platform add blackberry

Run any of these from a Windows machine, where wp refers todifferent versions of the Windows Phone operating system:

    $ cordova platform add wp7$ cordova platform add wp8$ cordova platform add android$ cordova platform add blackberry

Run this to check your current set of platforms:

    $ cordova platforms ls

(Note the platform and platforms commands are synonymous.)

Run either of the following synonymous commands to remove a platform:

    $ cordova platform remove blackberry$ cordova platform rm android

Running commands to add or remove platforms affects the contents ofthe project'splatforms directory, where each specified platformappears as a subdirectory. Thewww source directory is reproducedwithin each platform's subdirectory, appearing for example inplatforms/ios/www orplatforms/android/assets/www. By default,each platform's configuration file is set up to be able to access allof Cordova's APIs.

If you wish, you can use an SDK at this point to open the project youcreated. However, any edits you make to the project within an SDKaffect the derivative set of assets, not the original cross-platformsource files. Use this approach if you simply want to initialize aproject.Read on if you wish to use command-line tools for the entiredevelopment cycle.


Build the App

By default, the cordova create script generates a skeletal web-basedapplication whose home page is the project'swww/index.html file.Edit this application however you want, but any initialization shouldbe specified as part of thedeviceready event handler, referenced bydefault from www/js/index.js.

Run the following command to iteratively build the project:

    $ cordova build

This generates platform-specific code within the project's platformssubdirectory. You can optionally limit the scope of each build tospecific platforms:

    $ cordova build ios

The cordova build command is a shorthand for the following, which inthis example is also targeted to a single platform:

    $ cordova prepare ios$ cordova compile ios

In this case, once you run prepare, you can use Apple's Xcode SDK asan alternative to modify and compile the platform-specific code thatCordova generates withinplatforms/ios. You can use the sameapproach with other platforms' IDEs.


View the App in an Emulator

SDKs for mobile platforms come bundled with emulators that execute adevice image, so that you can launch the app from the home screen andsee how it interacts with many platform features. Run a command suchas the following to rebuild the app and view it within a specificplatform's emulator:

    $ cordova emulate android

Some mobile platforms emulate a particular device by default, such asthe iPhone for iOS projects. For other platforms, you may need tofirst associate a device with an emulator.For example, you may first run theandroid command to launch theAndroid SDK, then run a particular device image, which launches itaccording to its default behavior:

Following up with the cordova emulate command refreshes the emulatorimage to display the latest application, which is now available forlaunch from the home screen:




推荐阅读
  • 深入解析Unity3D游戏开发中的音频播放技术
    在游戏开发中,音频播放是提升玩家沉浸感的关键因素之一。本文将探讨如何在Unity3D中高效地管理和播放不同类型的游戏音频,包括背景音乐和效果音效,并介绍实现这些功能的具体步骤。 ... [详细]
  • 本文详细探讨了 Android Service 组件中 onStartCommand 方法的四种不同返回值及其应用场景。Service 可以在后台执行长时间的操作,无需提供用户界面,支持通过启动和绑定两种方式创建。 ... [详细]
  • Hadoop MapReduce 实战案例:手机流量使用统计分析
    本文通过一个具体的Hadoop MapReduce案例,详细介绍了如何利用MapReduce框架来统计和分析手机用户的流量使用情况,包括上行和下行流量的计算以及总流量的汇总。 ... [详细]
  • C/C++ 应用程序的安装与卸载解决方案
    本文介绍了如何使用Inno Setup来创建C/C++应用程序的安装程序,包括自动检测并安装所需的运行库,确保应用能够顺利安装和卸载。 ... [详细]
  • 本文分享了作者在使用LaTeX过程中的几点心得,涵盖了从文档编辑、代码高亮、图形绘制到3D模型展示等多个方面的内容。适合希望深入了解LaTeX高级功能的用户。 ... [详细]
  • 本文介绍了Tomcat的基本操作,包括启动、关闭及首次访问的方法,并详细讲解了如何在IDEA中创建Web项目,配置Servlet及其映射,以及如何将项目部署到Tomcat。 ... [详细]
  • 本文详细介绍如何在SSM(Spring + Spring MVC + MyBatis)框架中实现分页功能。包括分页的基本概念、数据准备、前端分页栏的设计与实现、后端分页逻辑的编写以及最终的测试步骤。 ... [详细]
  • 本文探讨了互联网服务提供商(ISP)如何可能篡改或插入用户请求的数据流,并提供了有效的技术手段来防止此类劫持行为,确保网络环境的安全与纯净。 ... [详细]
  • 本文详细介绍了在Linux操作系统上安装和部署MySQL数据库的过程,包括必要的环境准备、安装步骤、配置优化及安全设置等内容。 ... [详细]
  • 本文介绍了如何解决 ChinaASP.Upload 错误 '80040002',即必须添加版权信息的问题,并提供了详细的步骤和注意事项。 ... [详细]
  • 本文探讨了使用Python实现监控信息收集的方法,涵盖从基础的日志记录到复杂的系统运维解决方案,旨在帮助开发者和运维人员提升工作效率。 ... [详细]
  • SSE图像算法优化系列三:超高速导向滤波实现过程纪要(欢迎挑战)
    自从何凯明提出导向滤波后,因为其算法的简单性和有效性,该算法得到了广泛的应用,以至于新版的matlab都将其作为标准自带的函数之一了&#x ... [详细]
  • 【MySQL】frm文件解析
    官网说明:http:dev.mysql.comdocinternalsenfrm-file-format.htmlfrm是MySQL表结构定义文件,通常frm文件是不会损坏的,但是如果 ... [详细]
  • 数据输入验证与控件绑定方法
    本文提供了多种数据输入验证函数及控件绑定方法的实现代码,包括电话号码、数字、传真、邮政编码、电子邮件和网址的验证,以及报表绑定和自动编号等功能。 ... [详细]
  • 本文回顾了作者在求职阿里和腾讯实习生过程中,从最初的迷茫到最后成功获得Offer的心路历程。文中不仅分享了个人的面试经历,还提供了宝贵的面试准备建议和技巧。 ... [详细]
author-avatar
yolo_bean
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有