热门标签 | 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:




推荐阅读
  • 本文深入探讨了Linux系统中网卡绑定(bonding)的七种工作模式。网卡绑定技术通过将多个物理网卡组合成一个逻辑网卡,实现网络冗余、带宽聚合和负载均衡,在生产环境中广泛应用。文章详细介绍了每种模式的特点、适用场景及配置方法。 ... [详细]
  • 掌握远程执行Linux脚本和命令的技巧
    本文将详细介绍如何利用Python的Paramiko库实现远程执行Linux脚本和命令,帮助读者快速掌握这一实用技能。通过具体的示例和详尽的解释,让初学者也能轻松上手。 ... [详细]
  • 本文详细介绍了macOS系统的核心组件,包括如何管理其安全特性——系统完整性保护(SIP),并探讨了不同版本的更新亮点。对于使用macOS系统的用户来说,了解这些信息有助于更好地管理和优化系统性能。 ... [详细]
  • 高效解决应用崩溃问题!友盟新版错误分析工具全面升级
    友盟推出的最新版错误分析工具,专为移动开发者设计,提供强大的Crash收集与分析功能。该工具能够实时监控App运行状态,快速发现并修复错误,显著提升应用的稳定性和用户体验。 ... [详细]
  • MySQL 数据库迁移指南:从本地到远程及磁盘间迁移
    本文详细介绍了如何在不同场景下进行 MySQL 数据库的迁移,包括从一个硬盘迁移到另一个硬盘、从一台计算机迁移到另一台计算机,以及解决迁移过程中可能遇到的问题。 ... [详细]
  • 在Python开发过程中,随着项目数量的增加,不同项目依赖于不同版本的库,容易引发依赖冲突。为了避免这些问题,并保持开发环境的整洁,可以使用Virtualenv和Virtualenvwrapper来创建和管理多个隔离的Python虚拟环境。 ... [详细]
  • 本文提供了 Xcode 12.0 和 12.1(版本号 16B91)开发工具包的下载链接及安装步骤。通过 Finder 和快捷键,您可以轻松访问和配置 DeviceSupport 文件夹,确保 Xcode 正常运行。 ... [详细]
  • 作为一名在大型手机游戏公司工作的程序员,尽管主要负责游戏逻辑和内容的开发,但对iOS底层开发接触较少。现在有了iPhone和可以虚拟MAC环境的电脑,希望能找到有效的iOS开发学习路径。 ... [详细]
  • 本文详细介绍如何使用Python进行配置文件的读写操作,涵盖常见的配置文件格式(如INI、JSON、TOML和YAML),并提供具体的代码示例。 ... [详细]
  • 本文详细介绍了在 Windows 2000 系统中启用 TELNET 服务时需要注意的 NTLM 配置问题,帮助用户解决常见的身份验证失败错误。 ... [详细]
  • 本文详细介绍了在使用 SmartUpload 组件进行文件上传时,如何正确配置和查找文件保存路径。通过具体的代码示例和步骤说明,帮助开发者快速解决上传路径配置的问题。 ... [详细]
  • 本文探讨了使用React Native框架开发的应用,在通过AppCenter构建iOS版本时遇到的‘CopyPlistFile’命令失败的问题,并提供了详细的解决方案。 ... [详细]
  • 如何使用Ionic3框架创建首个混合开发应用
    混合开发是指结合原生(Native)与网页(Web)技术进行移动应用开发的方法。本文将详细介绍如何利用Ionic3这一流行的混合开发框架,从环境搭建到创建并运行首个应用的全过程。 ... [详细]
  • 本教程旨在指导开发者如何在Mac上设置React Native的开发环境,以进行iOS应用的开发。文中详细介绍了必要的软件安装步骤,包括Xcode、Homebrew、Node.js、Watchman以及React Native CLI等工具的安装方法。 ... [详细]
  • 我在项目中发现设置了 GCC_NO_COMMON_BLOCKS = NO 的配置项,位于 Apple LLVM 编译器 3.1 的代码生成设置中。 ... [详细]
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社区 版权所有