Shazron's Cordova (aka PhoneGap) Blog

at Adobe Systems Inc.

What’s new in Cordova iOS 2.2.0

with 58 comments

1. Set Xcode 4.5 minimum (iOS 6 SDK, iOS 4.3 deployment target, no armv6)

Submission to the Apple App Store requires the latest SDK, which is iOS 6. The iOS 6 SDK only comes with Xcode 4.5. Xcode 4.5 drops support for armv6, thus the minimum deployment target supported is iOS 4.3. This means that support for the iPhone 3G, and iPod Touch 2nd Generation is dropped.

2. Fixed iOS 6 and iPhone 5 issues

  1. iOS 6 Contacts permissions support – this was the only API issue for iOS 6 that did not make it into 2.1.0
  2. Capture API – for capturing audio, a new microphone image has been added for the iPhone 5 dimensions, and the Capture API view controllers support the new iOS 6 orientation delegate methods
  3. Added iPhone 5 sized Splash Screen
  4. Added new iOS 6 orientation delegate methods, and fixed orientation bug: http://issues.cordova.io/1465
  5. iOS 6 LocalStorage changes (backup flag), see issue http://issues.cordova.io/1561 and new Cordova.plist setting change to allow for iCloud, local or no backup. 

3. FileTransfer API changes

  1. Added support for the onprogress event to get progress events for a FileTransfer operation
  2. Added the abort function to cancel a FileTransfer operation

See the API doc.

4. Cordova.plist new properties, and changed a property

  1. Added the iOS 6 property SuppressesIncrementalRendering – set to YES (defaults to NO) to wait until all new view content has been received before it is rendered.
  2. Added the iOS 6 property KeyboardDisplayRequiresUserAction – set to NO (defaults to YES) to open the keyboard when form elements get focus via JavaScript focus() call.
  3. Changed the property BackupWebStorage (string, defaults to ‘cloud’) – valid values are ‘none’, ‘cloud’ and ‘local’. Set to ‘cloud’ to allow the web storage data to be backed up to iCloud, and set to ‘local’ to only allow local backups (iTunes sync). Set to ‘none’ to not allow any backups of web storage. The previous boolean property is deprecated and mapped to ‘cloud’ (true) and ‘none’ (false).

See the Project Settings doc.

5. Graduated the Globalization plugin to core

This plugin was previously in the phonegap-plugins repo (BB WebWorks 5, iOS, Android). The globalization object obtains information and performs operations specific to the user’s locale and timezone.

See the API doc.

6. bin/create script changes

In 2.2.0 by default, the CordovaLib sub-project is copied into your project folder. Previously the CordovaLib sub-project was linked in to your project as a shared project. To still use a shared CordovaLib, add “–shared” as the first parameter to bin/create. This is useful for committers to just point to the CordovaLib from their git repo.

7. uncrustify hook for committers

Uncrustify is a utility that beautifies your code — essentially it enforces certain code formatting conventions. Right now it is only added to the iOS repo as a trial. See the issue: http://issues.cordova.io/625

In the root of your iOS repo, using the command line:

cd .git
rm -r hooks
ln -s ../hooks .

Otherwise, you should run the bin/uncrustify.sh command manually before checking in code on iOS.

8. onReset() override for plugins

Add a onReset() method to your plugin — this is called on top-level navigation or refresh, so that plugins can know to cancel any long-running requests and reinitialize themselves. This is for the situation where your WebView has been refreshed, and any operations and callbacks for plugins are invalid.

9. iOS JavaScript-Obj-C bridge improvements

  1. no longer broken for non file:// pages
  2. No longer shows failed requests in the remote web inspector
  3. 15% speed improvement in benchmarks

10. Splashscreen API

The Splashscreen API is now formally documented for iOS and Android.

View the Release Notes for other changes.

Written by shazron

October 27, 2012 at 4:42 pm

58 Responses

Subscribe to comments with RSS.

  1. Reblogged this on Giacomo Balli and commented:
    I upgraded my whole working suite yesterday (Snow Leopard to Mountain Lion, Xcode 4.2 to Xcode 4.5.1, PhoneGap 1.4.1 to PhoneGap 2.1).
    Luckily everything went super smooth (had to do it without backup since I can’t find the wall adaptor for my external hard-drive since I moved from Italy!).
    Later in the afternoon I read on twitter that the PhoneGap team released a new update.
    The good news is that they’re really getting good at making updates easy to adopt (just did it).
    This update is highly recommended since it addresses many little issues to fully use iOS6 (among other things).

    bigballi

    October 27, 2012 at 5:50 pm

    • Hardly beleive that

      just finnished my 7th ? upgrade this year and yet …. all the troubles again.

      just from the top of my head:
      – splash screen not working on iPhone 5
      – gps config crashes app
      – mess with arm7 xcodeproject file
      – phonegap static library does not link if not “default” path in xcode selected (not documented anywhere)
      … could continue for a while

      after one year experience with phonegap definitively leaving phonegap and moving to grown up stuff

      JZO

      November 3, 2012 at 7:52 am

      • Sorry to see you go. You’re welcome back anytime.

        shazron

        November 5, 2012 at 10:25 pm

  2. Is there another link for the Splashscreen API? The one above does not seem correct.

    Raymond Camden

    October 27, 2012 at 8:40 pm

    • Sorry about that. The docs have just been updated to the latest release.

      shazron

      October 30, 2012 at 10:50 pm

  3. Nice release.

    FYI, The Splashscreen API link current gets redirected to the 2.1.0 homepage. Manually switching to edge or 2.2.0rc1, there isn’t any mention about a Splashscreen API.

    aziemkowski

    October 28, 2012 at 12:58 am

    • Sorry about that. The docs have just been updated to the latest release.

      shazron

      October 30, 2012 at 10:50 pm

  4. Is 2.2.0 going to be released?

    Mike

    October 31, 2012 at 3:38 pm

    • Later this week, we’re tagging and packaging hopefully today.

      shazron

      October 31, 2012 at 5:39 pm

  5. […] a more in-depth look on changes, check out Shazron Abdullah’s blog about What’s New in Cordova iOS 2.2.0 and Simon MacDonald’s blog about What’s New in PhoneGap Android […]

  6. […] nuova release dell’ambiente di sviluppo include migliora anche il supporto a iOS e Android, che saranno ora in grado di eseguire codice dalle 15 alle 20 volte più velocemente! I […]

  7. […] nuova release dell’ambiente di sviluppo include migliora anche il supporto a iOS e Android, che saranno ora in grado di eseguire codice dalle 15 alle 20 volte più […]

  8. What happened to DebugView? I don’t see the Classes or the info in the guides anymore?

    Mighty Quinn

    November 3, 2012 at 2:07 pm

  9. […] nuova release dell’ambiente di sviluppo include migliora anche il supporto a iOS e Android, che saranno ora in grado di eseguire codice dalle 15 alle 20 volte più velocemente! I […]

  10. […] What’s New in Cordova iOS 2.2.0, Shazron Abdullah […]

  11. Is anyone else having the same Childbrowser installation issues with Cordova 2.2? Any solutions. It just stopped working (worked fine in 2.0)

    Rick Hassen (@rkhassen)

    November 6, 2012 at 2:47 am

    • Yes. I just upgraded from 1.8.1 to 2.2.0 and now ChildBrowser just comes up black. The last log message is “Opening URL…”.

      Trevor

      November 8, 2012 at 8:05 pm

    • When did you update ChildBrowser last? There could be updates fixing this issue in phonegap-plugins

      shazron

      November 8, 2012 at 9:45 pm

      • apologies… I just lost XCode’s reference to the xib file. Also had the bundle in the wrong place so I wasn’t seeing the Safari/back/forward icons. Cheers.

        Trevor

        November 8, 2012 at 9:49 pm

  12. […] changelog, or the two platform-specific posts published; one post on Android and the second post on iOS. Maybe you’ll find that they fixed exactly the feature you needed to make PhoneGap your […]

  13. Hi Shazron, our app is currently at PG 1.6.1 and today we are evaluating a switch to a 2.* version. We would have mainly 2 reasons to do that: 1) increasing speed on Android/iOS; and 2) increasing GPS response on iPhone. Therefore, reading about PG 2.1 VS 2.2, we have trouble deciding which one to go for: on the one hand, there is that phrase: Java…” your code will now execute 15-25 times faster than our old bridges” and that one: C… ” 15% speed improvement in benchmarks” which seem to favor 2.2 absolutely, *** BUT *** on the other hand there is a troubling reply to this blog that gives us pause (and concern): “gps config crashes app”. Could you please elaborate on that (potential) problem. A.R.

    Al Renaud

    November 7, 2012 at 7:32 pm

    • Not sure what issue that commenter was referring to. If he/she had a problem, it would have been looked at in our issue tracker. If it was this problem: https://issues.apache.org/jira/browse/CB-1520 this was fixed in 2.2.0

      shazron

      November 7, 2012 at 9:02 pm

      • Super sympatico having an answer so fast, Moving to PG 2.2 at the light of speed, thanks for that, A.R.

        Al Renaud

        November 8, 2012 at 12:26 am

  14. shazron, i dragged my correct size splash screen image into xcode, compile and run on my device, but the cordova cube splash screen shows instead, any ideas? This is on the most recent cordova 2.2.0

    Nathan

    November 9, 2012 at 7:47 pm

    • Might be Xcode not updating things, it happens. Delete the app on your device, and re-deploy.

      shazron

      November 12, 2012 at 10:59 pm

  15. I updated an iOS app from 2.1 to 2.2 using the instructions (http://docs.phonegap.com/en/2.2.0/guide_upgrading_ios_index.md.html#Upgrading%20Cordova%20iOS)

    but the updated AppDelegate.m uses autorelease, and automatic reference counting is turned off in newly-created apps. I thought the default was to have it on?

    Anyway, the instructions should probably note that if you upgrade AppDelegate.m to the latest version, make sure you fix the autorelease calls.

    Also, when I fix that and run the app, I’m getting the following error. Anyone else seeing something similar?

    0 CoreFoundation 0x3584888f __exceptionPreprocess + 163
    1 libobjc.A.dylib 0x37bef259 objc_exception_throw + 33
    2 CoreFoundation 0x3584ba9b -[NSObject doesNotRecognizeSelector:] + 175
    3 CoreFoundation 0x3584a915 ___forwarding___ + 301
    4 CoreFoundation 0x357a5650 _CF_forwarding_prep_0 + 48
    5 MyApp 0x00107049 -[CDVViewController viewDidLoad] (CDVViewController.m:219)
    6 MyApp 0x000da761 -[MainViewController viewDidLoad] (MainViewController.m:70)
    7 UIKit 0x332b5c8b -[UIViewController view] + 167
    8 UIKit 0x332b4461 -[UIWindow addRootViewControllerViewIfPossible] + 45
    9 UIKit 0x332a6e87 -[UIWindow _setHidden:forced:] + 295
    10 UIKit 0x333177d5 -[UIWindow makeKeyAndVisible] + 25
    11 MyApp 0x000da433 -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:109)

    JW

    November 12, 2012 at 8:52 pm

    • Use of autorelease is not exclusive to ARC. Please file an issue with the crash log at http://issues.cordova.io so the devs can take a look.

      shazron

      November 12, 2012 at 11:00 pm

      • I thought that autorelease was incompatible with ARC….when I use that file with autorelease, I get compilation errors.

        I found out that the crash was caused by having BackupWebStorage=true instead of BackupWebStorage=cloud in my Cordova.plist file. This is something that you might also want to note in the release notes, since I think it changed with 2.2.

        JW

        November 12, 2012 at 11:12 pm

      • Ah ok, now it is much clearer – it was a bug, but should be fixed in 2.3.0: https://issues.apache.org/jira/browse/CB-1824

        shazron

        November 12, 2012 at 11:14 pm

  16. Hi Shazron,
    I’m hoping you can help, we have show stopper issue on iOS using latest PhoneGap (2.2.0) ….it seems after an update (iOS or App) permanent files are no longer available…see here for more detail:

    http://comments.gmane.org/gmane.comp.handhelds.phonegap/36797

    Thanks

    Javed

    November 14, 2012 at 4:02 am

    • I believe I answered on the Google Group already 🙂
      Re-cap:
      Are you storing the whole URL, and not a relative one? Just reconstruct from the relative one, prepending the permanent storage filesystem location.

      shazron

      November 15, 2012 at 8:15 pm

  17. Thank you “KeyboardDisplayRequiresUserAction”. I can finally make the keyboard appear on the search page automatically.
    Kudos to the dev team. ^_^

    bonta999

    November 15, 2012 at 7:44 pm

  18. Thanks for all the good work – I do have a quick question though…

    The splash screen on iPad seems to jump down 20 pixels at startup. This doesn’t happen on the iPhone.

    This happens on the simulator and on the device itself.

    I’m running mountain lion, Xcode 4.5.2, Cordova 2.2.0

    Any suggestions? Thanks!

    Dr. Bob

    November 16, 2012 at 1:54 am

    • No reply to this question? Really?

      Dr. Bob

      November 28, 2012 at 11:48 pm

      • Sorry I must have missed your comment. It might have to do with the splashscreen sizes that we use. Check the dimensions: http://docs.phonegap.com/en/2.2.0/cordova_splashscreen_splashscreen.md.html#Splashscreen

        shazron

        November 29, 2012 at 1:59 am

      • Thanks for your reply – I know you are very busy. And FYI you have been super-helpful in the past!!

        The issue still occurs even with the 768 x 1024 size splash screen. This happens on the Hello World demo app as well – it just happens more quickly on the demo app. This issue occurs on the demo app when using 768 x 1004 portrait splash screen (the one that comes by default in the build) and also when I replace it with the size specified in the docs – 768 x 1024.

        I’m hoping to update all of my apps in the coming weeks and this is the only issue standing in my way. It is a small issue – but I fear anything that might raise an eyebrow during the app review process – and it is something that does not occur in my apps currently. Note that this is not happening on the iPhone or iPhone-simulator – just on the iPad and iPad-simulator.

        Thanks again for your efforts. And just in case you guys don’t hear it enough – you guys rock!

        Dr. Bob

        November 29, 2012 at 3:54 am

      • UPDATE: OK I was able the solve the problem by commenting out a single line of code in CDVViewController.m file.

        Specifically, in showSplashScreen as shown below:

        case UIDeviceOrientationPortrait:
        default:
        {
        orientedLaunchImageFile = [NSString stringWithFormat:@”%@-Portrait”, launchImageFile];
        startupImageTransform = CGAffineTransformIdentity;
        // the line below is commented out by Dr Bob to prevent the 20 px jump at startup
        //center.y += MIN(statusBarFrame.size.width, statusBarFrame.size.height) / 2;
        }
        break;

        Now everything works as before – and as expected…

        Dr. Bob

        December 1, 2012 at 1:29 am

  19. I upgraded to cordova 2.2.0 and my pushwoosh push notifications stopped working. They only work when the iphone is unlocked…?

    Viking

    November 16, 2012 at 3:37 pm

    • Not sure – need more info. Perhaps contact the plugin author?

      shazron

      November 20, 2012 at 9:17 am

  20. And FYI – this also happens with the HelloWorld sample app found in the “Getting Stared with iOS” documentation. Thanks for any info 🙂

    Dr. Bob

    November 19, 2012 at 6:08 am

  21. I think the “upgrade to 2.2.0” document is missing an instruction to update Cordova.plist

    Eugene Savchenko

    November 21, 2012 at 2:33 pm

    • Thanks! Will fix.

      shazron

      November 21, 2012 at 9:11 pm

      • Also You need to update the BackupWebStorage value from TRUE/FALSE to the new string value (cloud.. etc).. I got NSInvalidArgumentException crash because the old plist value is Boolean but the expected value is String.

        tling

        November 26, 2012 at 12:24 am

  22. Hi Shazron, I understand where you’re going with Cordova,plist and the local config.xml etc. But that does not clear the following category of problems: what if we want to change the generated plist behaviour for iOS on say BackupWebStorage (from cloud to local) for a PG Build app (an app that is targeted for several platforms and therefore CAN’T be built locally by Xcode, Eclipse, etc.)? In my example, as I understand it, that’s needed in order to have access to any app-generated files on iTunes. Where do we do that for a PG Build (yes, that website at https://build.phonegap.com)? Thanks for any idea (ANY idea), A.R.

    Al Renaud

    December 13, 2012 at 12:57 am

    • PG Build has a config.xml specification: http://build.phonegap.com/docs/preparing-your-app#configure_application and I believe you just set a preference tag for what you want (BackupWebStorage). The Cordova iOS config.xml format and PG Build’s one is different however (we are planning on using the widget spec in a future release)

      shazron

      December 13, 2012 at 6:08 pm

      • Maybe, but you’re wrong at this point (“I believe you just set a preference tag for what you want (BackupWebStorage)”) and… it sucks! A.R.

        Al Renaud

        December 13, 2012 at 6:38 pm

    • I can’t help much there since I’m not on the Build team — reach out to the devs on http://community.phonegap.com

      shazron

      December 13, 2012 at 6:41 pm

      • Already did, different answer, same idea; how do they call that? oh yes: “the tale of 2 corporate heads”. A.R.

        Al Renaud

        December 13, 2012 at 6:48 pm

    • They do address config.xml issues: https://github.com/phonegap/build/issues/search?q=preference
      The forum issues generally get funnelled into Github issues. Perhaps file one there as well.

      shazron

      December 13, 2012 at 6:58 pm

      • Good idea, I think that’s my only chance of having something in that respect anytime soon! Thanks, A.R.

        Al Renaud

        December 13, 2012 at 7:38 pm

  23. hi guys i have a big problem facing in ipad 2 (ios version 6) . In my application am facing keyboard issue when keyboard enter am typing some thing my app screen event changed to portrait to landscape mode screen size button changed. but i will change the ipad portrait to landscape . the event will working.i will enter anything in keyboard the mode will be changed to por to land OR land to por mode how to fix plz help me guys. My application fully based on html5 .phone gap project

    Chris Jul

    March 14, 2013 at 2:22 pm

  24. Which version of phonegap has the function
    – (Void) showSplashScreen
    in CDVViewController class ?

    guy

    April 15, 2013 at 12:18 pm

    • Why? you shouldn’t rely on implementation details

      shazron

      April 16, 2013 at 12:20 am

      • I’m using phonegap version 1.7 and now I can not upgrade to the latest version.
        My application support in iPhone 5 and I have a problem with displaying Splash.
        I found the solution:

        – (void) showSplashScreen
        {
        CGRect screenBounds = [[UIScreen mainScreen] bounds];
        // HACK: PhoneGap pre-2.2 does not support iphone5 splash image well, so we just skip it
        if (screenBounds.size.height == 568) {
        return;
        }
        [super showSplashScreen];
        }

        but I see this warning
        CDVViewController may not respond to ‘showSplashScreen’

        guy

        April 17, 2013 at 6:41 am

  25. […] UPDATE 2: Cordova 2.2.0 has now been released, thus fixing this issue according to: https://shazronatadobe.wordpress.com/2012/10/27/whats-new-in-cordova-ios-2-2-0/ […]


Leave a reply to Mighty Quinn Cancel reply