Shazron's Cordova (aka PhoneGap) Blog

at Adobe Systems Inc.

Posts Tagged ‘Cordova.plist

What’s new in Cordova iOS 2.3.0

with 38 comments

cordova_bot

1. iOS 5.x and above support only

We are dropping iOS 4.x support and only supporting iOS 5.0 and greater, going forward.

2. Cordova.plist is changed to config.xml

The configuration Cordova.plist file has been changed to config.xml – it comes in a new format that is the same as the Android config.xml. If you are upgrading, you will need to convert your existing Cordova.plist by running the bin/cordova_plist_to_config_xml script. The 2.3.0 project itself will warn you (in the console log) if you are still using the old Cordova.plist and tell you to upgrade.

The new project settings are documented here.

An example config.xml:

<cordova>
        <preference name="MySetting" value="true" />
        <plugins>
            <plugin name="MyPlugin" value="MyPluginClass" />
        </plugins>
        <access origin="*" />
</cordova>

3. InAppBrowser – includes events

More details here. In a nutshell, this has the same functionality as the ChildBrowser, and has events support as well. It supports this simplified spec. Also, the InAppBrowser does not use the app whitelist. Example usage:


var ref = window.open('http://google.com', '_blank');
ref.addEventListener('loadstart', function(event) { alert(event.type + ' - ' + event.url); } );
ref.addEventListener('loadstop', function(event) { alert(event.type + ' - ' + event.url); } );
ref.addEventListener('exit', function(event) { alert(event.type); } );

// also, you can do ref.removeEventListener('loadstart', myfunc) .. etc

4. LocalNotification  plugin event, AppDelegate override

Your project’s AppDelegate.m can add a new AppDelegate override so your plugins can receive LocalNotification events. Uncomment these lines  to enable your plugin to receive the notifications in their overrides.

5. Renaming of Cordova cli commands

The new list of commands are here. Basically debug has been renamed to build, and new release,  and run commands have been added. This is common across all the platforms.

6. Objective-C plugins are not white-listed anymore

With the InAppBrowser release, we restructured the whitelist to only apply to the main Cordova WebView. As a consequence, the whitelist does not apply to all connections for the app, thus connections from your plugins are not whitelisted. To whitelist your connections with the app whitelist, you will need to set the “User-Agent” header of the connection to the same user-agent as the main Cordova WebView.

You can get this by accessing the userAgent property off the main view-controller. The main view-controller (CDVViewController) also has a URLisAllowed method for you to check whether a URL will pass the whitelist. See this guide.

7. Device API changes

Minor changes as specified here. For iOS, device.platform used to return “iPhone”, “iPad” or “iPod Touch” — now it returns (correctly) “iOS”. For iOS, device.name (now deprecated for all platforms) used to return the name of the user’s device (e.g ‘Shazron’s iPhone 5′) — now it returns what device.platform used to return: “iPhone”, “iPad” or “iPod Touch”.  For all platforms, there is a new property called device.model — this returns the specific device model, e.g “iPad2,5″ (for other platforms, this returns what device.name used to return).

8. CommandDelegate overrides

The command delegate could not be overriden properly, now fixed. Please look at this issue on how to override the delegate functions, for inspection.

Check out the Release Notes for other minor changes.

Written by shazron

December 10, 2012 at 9:37 pm

Follow

Get every new post delivered to your Inbox.

Join 1,412 other followers

%d bloggers like this: