11 upcoming changes for Cordova iOS 2.1.0

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.

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.

All I did was create a base project via the command line (since it doesn’t show up in the application launcher when I start Xcode), and attempted to build and run it. 19 yellow issues, nothing is red. This could very well be a user error–I just have no options to run this anywhere… not in any menus or buttons or anywhere. :O I had assumed that the yellow warnings were preventing me from having the option to run it.

You find the scheme in the Product menu, then Edit Scheme (Command + <). Change the two drop downs at the top of the screen to your project name, and then the device you want to simulate. Hit ok, and then go to the Product menu and select Run (Command + R). Wait, be patient! It eventually shows up.🙂

[…] 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 […]

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.

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.

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 …

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.