Shazron's Cordova (aka PhoneGap) Blog

at Adobe Systems Inc.

11 upcoming changes for Cordova iOS 2.1.0

with 37 comments

1. Automatic Reference Counting (ARC) support

Finally the Cordova core has been upgraded to use ARC. Your project does NOT need to use ARC, but you can upgrade your project if you want using the Xcode menu option “Edit -> Refactor -> Convert to Objective-C ARC…”, then de-select libCordova.a. Note that if you do so, your plugins will need to be upgraded to use ARC as well. If doing so for plugins causes problems, you can disable ARC per file.

2. Removal of the (.pkg) Installer

This frankly was a stop gap in 2.0.0 until we removed it entirely. There is nothing to install now, you just download the source, and put it somewhere on your hard-drive in a permanent location. New projects when created using the command-line tool will refer to the CordovaLib that you ran the script from automatically. Note that if you move the source folder, you will need to run bin/update_cordova_subproject to update any existing projects.

3. Removal of the use of CORDOVALIB

In Cordova versions before 2.1.0, the location of the CordovaLib sub-project was through an Xcode variable called CORDOVALIB. So, when you updated your CordovaLib, your existing projects will pick up the new CordovaLib automatically by referencing this Xcode variable. This has proven to be problematic for using multiple versions of Cordova. Now, when you create a new project, the new project will have a hard-coded location for the CordovaLib sub-project, and to update this location you run the bin/update_cordova_subproject script which is located in a downloaded source version.

NOTE: This script updates the location of the CordovaLib sub-project as “relative to group” which means relative to where your project is located. This means, if you move your project folder, the CordovaLib sub-project reference will break (and you need to run the script again). This is mainly for source control purposes (where an absolute location is not friendly for teams). Watch this jira issue for updates.

4. Removal of the VERSION file dependency in code

The VERSION file is read from CordovaLib and set in JavaScript as the variable device.cordova, the code is not dependent on this file anymore (it may still be referred to in the Makefile), and reads the version from CDVAvailability.h at run-time.

5. Removal of CordovaLibApp and CordovaLibTest targets from the CordovaLib sub-project

When the CordovaLib sub-project is included in your project, all of its targets are included in the Schemes dropdown menu as well. This confused a lot of devs, and we removed the two extraneous targets into its own project. Those two targets are only used for testing. So now your Schemes dropdown menu will only include your project’s target, and the CordovaLib target.

6. Command-line scripts supports spaces in pathnames, symlinks

If you had spaces in your path when you ran any of the command-line scripts in 2.0.0, the script will fail. We fixed the problem in Cordova 2.1.0. If you are running 2.0.0, you can fix the problem by just copying in the updated scripts to your project’s cordova sub-folder.

7.  Whitelist format is less strict

Previously, the whitelist required an exact string match, with hostnames/IPs only. Now you can enter a full url with scheme, paths and query parameters – they will be parsed and only the hostname/IP will be considered.

8. New JavaScript->Native bridge

Our previous method used iframes, and starting with 2.1.0, we added an xhr bridge method by default. More details in this JIRA issue. This is to work around crash issues related to iOS UIWebView WebKit. You can change to the previous bridge implementation as well, the details are in the same JIRA issue linked previously. Note however that there is a bug in using the xhr bridge mode in iOS 4.2, so if you are on iOS 4.x, it will automatically default back to the iframe bridge.

9. iOS 6 compatibility changes

Fixed some issues related to the upcoming iOS 6 release. ‘Nuff said.

10. Diagnostics

There have been a lot of problems related to headers not being found, or the Archive build failing. There will be a diagnostics tool to help debug these issues. This tool is not in the rc1 yet, but will be in the final 2.1 release. Watch the related JIRA issue here.

11. New plugin signature (old signature is deprecated)

The new plugin signature is discussed in the Plugin Development Guide for iOS and also the Plugin Upgrade Guide. The old signature is still supported as per our deprecation policy.

About these ads

Written by shazron

August 28, 2012 at 1:18 am

Posted in cordova, phonegap

37 Responses

Subscribe to comments with RSS.

  1. This is very useful for Developers upgrading from previous versions. I find the official docs lack this level of documentation. Very Sexy. Thanks Shazron.

    Ally

    August 29, 2012 at 2:44 am

    • Concerned about 8. New JavaScript->Native bridge
      “twice as slow” bridge? That would really suck :(

      Ally

      August 29, 2012 at 2:58 am

      • In most cases, practically the speed would not matter. We provide the option of you switching back to the old bridge – but providing the xhr bridge as the default option works around the more critical issues related to crashing. We are at the mercy of the underlying bugs in WebKit, and we had no other choice to prevent crashes.

        shazron

        August 29, 2012 at 8:45 am

  2. Hi, When this version will be released ? I plan to start a project with Phonegap, but i want to do it directly with this version. And can’t find a detailed roadmap :(

    Christophe

    August 29, 2012 at 9:56 am

  3. thank you shazron :)

    Emile Khattar

    August 29, 2012 at 6:16 pm

  4. [...] 2.1 release. If you haven’t seen it already, be sure to check out Shazron’s post: 11 upcoming changes for Cordova iOS 2.1.  Changes include Automated Rererecnce Counting (ARC) support, an updated Native-JavaScript [...]

  5. Curious as to what may have changed in the .xcodeproj file that is failing for my build when testing with RubyMotion build tools and 2.1rc2. Hoping you may be able to point out something obvious.

    I wrote up an article about this, which is working great on 2.0, but fails to build on 2.1rc2
    http://www.willprater.me/blog/2012/08/21/using-rubymotion-to-build-javaScript-based-ios-apps/

    Error:
    ====
    Build vendor/CordovaLib
    ERROR! Building vendor project `vendor/CordovaLib’ failed to create at least one `.a’ library.
    ====

    Will Prater

    September 2, 2012 at 2:02 pm

    • you can remove the above comment, I figured it out. I’d left the other .xcodeproj file in there and it was not sure which config to build towards! You can specify the file to use in the build task.

      Will Prater

      September 3, 2012 at 2:07 pm

  6. [...] 11 Upcoming Changes for Cordova iOS 2.1.0, Shazron Abdullah [...]

  7. Hi i looked into cordova re camera jquery, and i have this question

    Can i have a mobile app where i can capture my photo and then add an image above it and save it.

    like take my face and put hat about it?

    hope to hear from you soon..

    Thanks

    Molham

    Molham Bakir

    September 12, 2012 at 5:59 am

  8. The contacts on iOS 6.0 are not loading with this update … any news?

    Matthew Encke

    September 23, 2012 at 3:19 am

  9. [...] been fully migrated to use Automatic Reference Counting (ARC). Checkout Shazron’s blog about changes in Cordova 2.1.0 for iOS and how to update plugins to work with ARC. PhoneGap also supports iOS 6 [...]

  10. Hi,
    im having the orientation issue with xcode4.5 that has reportedly been fixed in phonegap 2.1. Iv downloaded and installed PG2.1 but the issue is still there. Even in the default app that is made when PG is installed (without any change whats so ever) has this issue. Basically, the app retains the width it starts in, if started in landscape, remains larger than the screen with in portrait, or if launched in portrait, is smaller in width than the landscape width with black area to the right, in both iphone and ipad.

    Iv been searching and trying a fix by tweaking the xcode orientation settings of the app for 2 days now without any luck. Is there anything i can do to fix this issue.

    Thanks

    Fahad

    September 27, 2012 at 4:20 pm

    • After 2 days of searching, if found the issue, which was quite silly in the end. The new phonegap projects index.html file has this meta tag of viewport that sets width and hight to constant. This replicates the exact issue that was due to xcode4.5 (reportedly fixed in PG 2.1). Every time i created a new project to test it would always have the same issue of not adjusting width. During my previous fixing attempts for the original problem i had copied the exact meta tags from the default PG project. Fixed after removing those attributes from the viewport meta tag.

      Fahad

      September 28, 2012 at 12:14 pm

  11. [...] 11 upcoming changes for Cordova iOS 2.1.0 « Shazron’s Cordova (aka PhoneGap) Blog – 11 upcoming changes for Cordova iOS 2.1.0 [...]

  12. Hi when I use Cordova 2.1 to build applications.I meet a problem.Xcode can’t update launch images and icons.Even if I replace the files in the folder.But it doesn’t work.How to deal with it?Please tell me … Hope for your reply …

  13. I did a fresh install on a computer that did not have PG before, but encountered serious issues with building for iOS. My target is set to my project, yet it does not compile. I get the following errors:

    Cordova/CDVViewController not found
    Cordova/CDVViewController.h file not found

    I followed the install guide for ios steps on the getting started guide (aside from executing the .pkg as there is none), but it does not work.

    Any ideas as to how to fix this?

    Thanks

    ayame007

    October 19, 2012 at 2:40 pm

    • Did you still need help with this? Let me know I can walk you through an/or make you run a diagnostic script.

      shazron

      October 30, 2012 at 10:56 pm

  14. Hi Shazron, Thanks very much for the post. I have an ios application based on phonegap 1.4.1, I would like to upgrade my project to the latest version of the phonegap, what is the best approach?
    I have asked this question in stack over flow, waiting for your response. Thanks http://stackoverflow.com/questions/13266259/upgrade-phonegap-for-ios-from-1-4-1-to-latest

    Claire

    November 7, 2012 at 9:18 am

    • Hi, I replied to your StackOverflow post.

      shazron

      November 7, 2012 at 9:06 pm

      • Hi Shazron, thanks so much for you suggestion. I will try that. Will keep you updated.

        Claire

        November 7, 2012 at 9:38 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 1,412 other followers

%d bloggers like this: