PhoneGap and Cordova with iOS 7
Now that it’s officially available, I wanted to share my experience running and building PhoneGap / Cordova applications on iOS 7.
Running Existing Apps
The first thing I tried to do after the upgrade process was to run the existing PhoneGap applications already installed on my phone. Good news: They run “as is” (with a minor cosmetic issues: see below).
Building and Deploying
Building and deploying new apps was also pretty straightforward. Here are the steps (I’m assuming PhoneGap 3):
- Install Xcode 5: the update is available in the App Store on your Mac.
- Start Xcode 5 before building your application to make sure Xcode downloads the required components. Before you can build a project using the PhoneGap or Cordova command line tool, you’ll also have to accept the new license agreement in Xcode 5.
- Build your PhoneGap application as usual on the command line:
phonegap build ios
- Open the project (the .xcodeproj file in platforms/ios) in Xcode, and run it on your device.
The Status Bar Issue
On iOS7, all the applications are running full screen, and the status bar now overlays your application. As a result, it may cover some of your content or interfere with your header:
Different solutions have been discussed in the forums (here and here). Some of them involve native code to offset the web view. I think the simplest and cleanest solution is to add a 20px top margin to the document’s body using CSS. You can use version detection to avoid adding the margin if the application is running on iOS 6. Shazron posted a nice Gist with a simple solution:
function onDeviceReady() { if (parseFloat(window.device.version) === 7.0) { document.body.style.marginTop = "20px"; } } document.addEventListener('deviceready', onDeviceReady, false);
Here is the result:
Cordova 3.1
Cordova 3.1 is expected soon (probably next week) with additional iOS 7 support:
- Update to the splashscreen plugin to better support the status bar
- Update to the Media and Media Capture plugins to handle the new Microphone access permissions
- A fix to this bug (keyboard preferences)
Topcoat
iOS 7 is another reason to take a look at Topcoat, the new CSS toolkit that I have already covered and demonstrated multiple times in this blog. Topcoat’s flat design with no gradients or shadows fits perfectly with the new aesthetics of iOS7. Topcoat is just a set of CSS styles and works with any JavaScript framework: Backbone.js AngularJS, Ember, etc.
相关推荐
Optimize and increase the performance of you applications with Phonegap/Cordova plugins A step by step guide, filled with real-world examples to help you create hybrid mobile applications Who This ...
Using Facebook’s Parse as backend service, and Adobe’s PhoneGap (or Cordova) as a mobile development framework, building a highly customizable application is easier than you can imagine. A basic ...
《Wrox.Beginning.iOS.Application.Development.with.HTML.and.JavaScript.2012》这本书主要探讨了如何使用HTML和JavaScript技术来开发iOS应用。这是一门跨平台的技术,它允许开发者利用熟悉的Web技术来构建原生的...
Learn how to build app store-ready hybrid apps with the Ionic 2, the framework built on top of Apache Cordova (formerly PhoneGap) and Angular. This practical guide shows you how to use Ionic’s tools ...
Learn how to build app store-ready hybrid apps with the Ionic 2, the framework built on top of Apache Cordova (formerly PhoneGap) and Angular. This practical guide shows you how to use Ionic’s tools ...
PhoneGap (now known as Apache Cordova) is an open-source framework that allows developers to build cross-platform mobile applications using HTML, CSS, and JavaScript. Version 3.x of PhoneGap ...
在iOS应用中嵌入Cordova并使用原生导航栏是一个常见的需求,特别是在开发混合移动应用时。Cordova,原名为PhoneGap,是一个开源框架,它允许开发者使用HTML、CSS和JavaScript来构建移动应用,同时利用原生平台的能力...
PhoneGap 支持 iOS、Android、Windows Phone 等多个操作系统,并通过 Apache Cordova 提供与原生设备功能的接口,如访问摄像头、GPS 和加速度计等。 `vagrant-phonegap` 将这两个工具结合在一起,提供了一个即开即...
它能够在 Cordova/Phonegap 平台上方便的使用 iOS 和安卓系统上的本地 SDKs。但使用它的时候必须下载 PayPal Mobile SDK 库。 标签:PayPal 分享 ...
7. **多平台兼容性**:尽管本项目专注于Android,但PhoneGap的跨平台特性意味着服务可能也需要考虑iOS和其他平台。理解不同平台的推送通知机制和适配策略是必要的。 通过这个项目,开发者可以学习到如何结合...
一种从 PhoneGap/Cordova 加载和播放音频的简单方法。 :grinning_face_with_smiling_eyes: 这仍然是一项正在进行的工作。 待办事项 在它的 JavaScript 方面工作。 测试,测试,再测试! 平台 安卓 iOS(计划很快)...
添加了在 PhoneGap 应用程序的日历中创建和编辑事件的功能。 遵循,以便它与一起,或者您可以在下面手动安装它。 var calendar = cordova.require("cordova/plugin/Calendar"); /* Adds an event to the ...
Vuetify-Cordova VuetifyJs App模板可用于Cordova App。...cordova platform add ios 生成命令 # serve with hot reload at localhost:8080 npm run dev # build for production with minification npm run build
showTorchButton: true, // iOS and Android 显示开起手电筒的按钮 torchOn: false, // Android, launch with the torch switched on (if available) prompt: "请将二维码放在扫描框中", // Android 提示信息 ...
在提供的压缩包文件"Can-I-create-Windows-8-xaml-app-with-phonegap.pdf"中,可能会详细阐述这些概念和步骤,包括如何配置项目、如何编写桥接代码以及如何测试和调试混合应用。建议仔细阅读这份文档,以获取更深入...
该源码由源码天堂IOS源码频道免费提供下载。利用 html5 和 phonegap 实现360度全景展示。说明: 1. 打开ImportPhoenGapProject.xcodeproj项目。2. 将CordovaLib文件夹下的CordovaLib.xcodeproj项目拖进打开的...