Tuesday 25 September 2012

Workaround for ios6 Phonegap 2.0.0 linker error

Problem:

After upgrading to ios6 and XCode 4.5, when trying to compile my old PhoneGap/Cordova project on an iOS device I get the following error:

"_OBJC_CLASS_$_CDVURLProtocol", referenced from:
Objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_CDVViewController", referenced from:
_OBJC_CLASS_$_MainViewController in MainViewController.o
"_OBJC_METACLASS_$_CDVViewController", referenced from:
_OBJC_METACLASS_$_MainViewController in MainViewController.o
Symbol(s) not found for architecture armv7s

This error may not necessarily show up when running the program in the simulator.

Temporary workaround:

To have your old PhoneGap project working again, you can try the following:

  • in XCode 4.5, click on your project and click "build settings"
  • change Architecture to "Standard (armv7, armv7s)"
  • change Valid Architectures to be only "armv7, armv7s"
  • change Build Active Architecture Only to "Yes"

You may also have to do this for the linked CordovaLib.xcodeproj. This temporary workaround assumes that you have been using a build configuration similar to the default configuration (e.g. things haven't been heavily customized).

Notes:

This workaround won't work for projects using older versions that import PhoneGap as a precompiled framework. It should work for versions that import CordovaLib.xcodeproj, but no guarantees.

Keep a lookout for updates with the Apache Cordova/PhoneGap project as this workaround is only a temporary fix for those looking to test their old projects after upgrading their devices to iOS6. Chances are that this bug will be fixed by the PhoneGap team, if it already hasn't been. This workaround will result in dropped support for older ios devices (as the armv7s instruction set isn't supported by devices older than the iPhone 3GS). This workaround was tested with XCode 4.5 and Apache Cordova 2.0.0 on devices with the old 3.5 inch retina screen, recently upgraded to ios6. This workaround has not been tested in a deployed/production setting.

No comments:

Post a Comment