Shazron's Cordova (aka PhoneGap) Blog

at Adobe Systems Inc.

Cordova iOS and iOS 8

with 40 comments

ios8-heroiOS 8 was just released – and Cordova supports it fully, but it is still using the existing UIWebView iOS browser component (more on the new iOS 8 WKWebView later).

The main issues were in the core plugins, which have since been updated in the Cordova Plugin Registry. Update your plugins by removing and re-adding them.

If you use any of these plugins below, you will need to update these plugins and re-release your app for iOS 8, since your existing app built pre-iOS 8 may be broken in iOS 8 without these fixes.

These plugins have been updated for iOS 8:

Plugin
1. Camera
2. Geolocation
3. StatusBar
4. Contacts

Camera

This plugin had a fix to use the new Geolocation permissions in iOS 8. Users are now prompted whenever you require a geolocation – this is for the JPEG format EXIF data. The plugin has a new preference as well, called CameraUsesGeolocation which defaults to false. Previously you had no control over this, it was always true.

Geolocation

This plugin had a fix to use the new Geolocation permissions in iOS 8. Users are now prompted whenever you require a geolocation.

Contacts

This plugin had a fix for pickContact — iOS 8 has added new delegate functions to handle people picking, without the fix this feature was broken in iOS 8.

StatusBar

Landscape mode for the StatusBar plugin was broken in iOS 8, and the updated plugin fixes it. This is because on iOS 8, screen size is now orientation dependent — previously it was based off portrait mode. The StatusBarBackgroundColor preference is now omitted as well when you install the plugin, leaving it effectively transparent (was #000000 or black). You will have to now set it explicitly.

CDV_IsIPhone5 macro

For whatever reason you are using this, realize that it is broken currently (same reason as the StatusBar landscape fix). If your plugin is not using this macro, don’t worry about it. It has already been fixed for 3.7.0.

JavaScript

If you are using the Web Inspector, you might see “deprecated attempt to access property” errors that are harmless. It has already been fixed for 3.7.0.

WKWebView

Webkit_LogoWe tried.

Unfortunately there is a serious bug in WKWebView where it can’t load file:// urls, so it has hampered our efforts. This functionality was working in iOS 8 betas 1 to 3 on the device (it always works in the iOS 8 Simulator), but broken after that. I’m not sure what the ETA for the bug fix is, but it is in Apple’s radar (literally!).

In the meantime, we have some ideas, like running a local webserver to load the local assets. More info and discussion here.

For all the issues related to Cordova iOS and iOS 8, including our work in getting WKWebView support, check out this task list.

Written by shazron

September 18, 2014 at 11:44 pm

Posted in cordova, phonegap

Cordova iOS Plugin Interface – upcoming changes

leave a comment »

PluginThe plugin interfaces below will be deprecated in Apache Cordova 3.6.0 (iOS), and will be removed totally in the major release of 4.0.0 later this year. Please plan accordingly if you have plugins that use these interfaces.

If you followed the 3.x Guides on how to create and use plugins, you should be OK, these interfaces have been there pre-3.x and were documented in the 2.x stream, but not in the 3.x stream. If you need to upgrade, consult the docs for the new methods.

CDVPlugin:

- (NSString*)writeJavascript:(NSString*)javascript;
- (NSString*)success:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId;
- (NSString*)error:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId;

CDVPluginResult:

- (NSString*)toJSONString;
- (NSString*)toSuccessCallbackString:(NSString*)callbackId;
- (NSString*)toErrorCallbackString:(NSString*)callbackId;

Written by shazron

July 21, 2014 at 11:26 pm

Posted in cordova, phonegap

PhoneGap Facebook Plugin – maintenance update

with 5 comments

PluginBeginning today – the PhoneGap Facebook Plugin has a new home under Wizcorp. Ally Ogilvie of Wizcorp has been doing a great job of maintaining this plugin thus far, and his excellent stewardship of the plugin will continue on. Read his blog post on this.

Please update your bookmarks and point your git urls to the new location when adding a plugin using the CLI.

Alternatively, you could try a JavaScript only solution, read this blog post and browse the source code. This JavaScript only solution has some drawbacks however – you will lose Single Sign On, events, and ad tracking.

Written by shazron

July 14, 2014 at 2:43 am

Posted in cordova, phonegap

Cordova Keyboard Plugin – maintenance update

with 3 comments

PluginThis iOS only plugin has been moved some time ago to the org.apache.cordova.labs namespace so it has not affected any plugin releases.

I feel that this type of plugin is better off in the hands of 3rd party devs — please see the ionic keyboard plugin for example. I personally am not going to be maintaining it anymore primarily because of the testing complexity (see manual tests in mobile-spec) and I prefer not to muck around with the keyboard native views (which is extremely hacky) – it’s best to leave the current keyboard as is, for example see the iOS Gmail app — besides under the flat UI in iOS 7 it doesn’t look as bad.

I believe none of the other core committers plan to maintain the code as well. With iOS 8,  there is support for custom keyboards, so this plugin’s future is limited. As usual, the code is open-sourced, and pull requests are still welcome but the plugin won’t be tested and won’t be published on http://plugins.cordova.io. You can still install the plugin by using the git url:

cordova plugin add https://github.com/apache/cordova-plugins.git#master:keyboard

iOS 7 also made “keyboard-shrinks-view” the default (much better for apps), and eventually when iOS 8 is released the minimum supported version of future Cordova releases would default to iOS 7 as well.

Currently there are ~20 open issues in JIRA, and ~2 open pull requests in Github.

Written by shazron

July 9, 2014 at 8:27 am

Posted in cordova, phonegap

Xcode 5.1 and Cordova iOS

with 121 comments

cordova_botUPDATE: Cordova CLI  3.4.1-0.1.0 is out, which includes Cordova iOS 3.4.1 which incorporates all the fixes mentioned in this blog post. Update your Cordova CLI, and if you have an existing project, do a “cordova platform update ios“.

These issues have been fixed if you are running the latest dev code (slated for 3.5.0).

There are 3 issues related to Cordova iOS 3.4.0 running with Xcode 5.1 (and its command-line tools):

1. CB-6150 – objc_msgSend causes EXC_BAD_ACCESS with plugins on arm64
2. CB-6223 – Build/linker errors
3. ios-sim does not work anymore

For the first issue, you need to look at the two files mentioned in this commit and patch the two lines affected.

For the second issue, you will need to update the Build Settings in your project. The steps are mentioned in the issue and reproduced below:

  1. Select your Project icon
  2. Choose Build Settings.
  3. For “Architectures”, select $ARCHS_STANDARD – Standard architectures (armv7, armv7s, arm64)
  4. For “Valid Architectures”, add “arm64″
  5. Select your CordovaLib.xcodeproj icon
  6. In the Build Settings for the Project (not Target), delete *all* the conditional architecture settings (hover to see the minus sign). This is what is recommended by Apple in their Xcode 5.1 Release Notes.
  7. For “Architectures”, select $ARCHS_STANDARD – Standard architectures (armv7, armv7s, arm64)
  8. For “Valid Architectures”, add “arm64″
  9. Goto 6, but now do it for “Target

For the third issue, you will have to update your ios-sim to version 1.9.0:

npm install -g ios-sim

ios-sim --version

Written by shazron

March 12, 2014 at 5:32 am

Posted in cordova, phonegap, xcode

Cordova iOS and iOS 7 Support

with 72 comments

PluginWith the release of Cordova 3.1.0, we added preliminary iOS 7 support, particularly the support of four new UIWebView properties: GapBetweenPages, PageLength, PaginationBreakingMode, and PaginationMode. There is more iOS 7 support added today in the core plugins listed below.

The config.xml parameters HideKeyboardFormAccessoryBar and KeyboardShrinksView also support the new iOS 7 keyboard. However, going forward these two properties have been removed in 3.2.0, and you will need to grab the new keyboard plugin (install using the plugin id org.apache.cordova.keyboard). The decision to remove this functionality into a plugin is so updates and fixes are not tied to a particular core release.

Also, the UIWebView properties stated above (as well as others related) will eventually be put into a plugin and not included in the core, the target for this is the 3.2.0 release.

These core plugins have been updated to support iOS 7:

There is also a new statusbar plugin (install using the plugin id org.apache.cordova.statusbar). This gives you an API to change the status bar to be like it was in iOS 6 (where the status bar does not overlay the webview). The plugin also gives you the ability to control the status bar appearance and visibility.

[UPDATE] The keyboard and statusbar plugin repos have been moved from the plugins branch of the cordova-labs repo to its own repo, cordova-plugins

Written by shazron

October 15, 2013 at 10:33 pm

Posted in cordova, phonegap

What’s new in Cordova iOS 3.0.0

with 13 comments

cordova_bot

Cordova 3.0.0 is released! Huge updates – more details in this blog post.
I have a blog post related to this as well – Streamline Cross-Platform Development Using Apache Cordova / PhoneGap CLI

To view a bug, change the bug number to this URL, e.g. http://issues.cordova.io/3999

* [CB-3999] Video Capture ignores duration option [iOS]
* [CB-4202] [CB-3681] Remove Contact plugin unit tests
* [CB-4202] [CB-3653] Remove EXIF (Camera plugin) unit tests
* [CB-4202] [CB-3726] Remove File Transfer plugin unit tests
* [CB-4202] [CB-3973] Remove unit test dependency on Dialogs plugin
* [CB-4202] [CB-1107] Remove unit tests for old plugin signature
* [CB-4202] [CB-4145] Remove use of useSplashScreen property by unit tests
* [CB-4095] Add some additional whitelist unit tests
* [CB-2608] Remove deprecate EnableLocation key from the config.xml file
* [CB-4104] Made config parameters case-insensitive.
* [CB-3530] PhoneGap app crashes on iOS with error “CDVWebViewDelegate: Navigation started when state=1″ (for navigation to an anchor on the same page)
* [CB-3701] Removed Capture.bundle from default project template for 3.0.0
* [CB-3530] Updated unit tests
* [CB-4025] iOS emulate command broken when run inside the cordova folder
* [CB-4037] Unable to Archive iOS projects for upload to App Store in 2.9
* [CB-4088] `cordova emulate ios` replaces spaces in project name with underscores, conflicting with `cordova build ios` behavior
* [CB-4145] Remove CDVViewController.useSplashScreen property
* [CB-3175] Change <plugin> to <feature> in config.xml and remove deprecation notice in iOS
* [CB-1107] Remove old plugin signature, update Plugin Dev Guide
* [CB-2180] Convert iOS project template to use ARC
* [CB-3448] bin/diagnose_project script fails if CORDOVALIB variable not in prefs plist
* [CB-4199] iOS Platform Script `run –device` uses Simulator
* [CB-3530] PhoneGap app crashes on iOS with error “CDVWebViewDelegate: Navigation started when state=1″ (for navigation to an anchor on the same page)
* [CB-3567] Redirect initiated in JavaScript fails the app from loading
* Removed iphone/beep.wav since it is already contained in the dialogs core plugin
* Have create script include .gitignore file.
* Removed all core plugins (including console logger) to their own repos (install them using cordova-cli or plugman)

Written by shazron

July 19, 2013 at 3:51 pm

Posted in cordova, phonegap

Follow

Get every new post delivered to your Inbox.

Join 1,531 other followers

%d bloggers like this: