Showing posts with label PhoneGap. Show all posts
Showing posts with label PhoneGap. Show all posts

Thursday, March 26, 2015

PhoneGap and Cordova upgrade to satisfy iOS8 64bit requirements

Using Phonegap and Cordova 3.3.1 for sometime I did not have any issue. However, after updating command line tools, Xcode and IOS simulator used to 7.1, I can no longer build a project even when creating from scratch.
I got about 12 errors, some related to plugins:
Ld /Users/me/Library/Developer/Xcode/DerivedData/HelloWorld-dsvozgctlgpqhxgogbudpossnucy/Build/Products/Debug-iphonesimulator/HelloWorld.app/HelloWorld normal x86_64
    cd /Users/konstantinos/Development/phonegap/profileapp/platforms/ios
    export IPHONEOS_DEPLOYMENT_TARGET=6.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -L/Users/konstantinos/Library/Developer/Xcode/DerivedData/HelloWorld-dsvozgctlgpqhxgogbudpossnucy/Build/Products/Debug-iphonesimulator -F/Users/me/Library/Developer/Xcode/DerivedData/HelloWorld-dsvozgctlgpqhxgogbudpossnucy/Build/Products/Debug-iphonesimulator -filelist /Users/me/Library/Developer/Xcode/DerivedData/HelloWorld-dsvozgctlgpqhxgogbudpossnucy/Build/Intermediates/HelloWorld.build/Debug-iphonesimulator/HelloWorld.build/Objects-normal/x86_64/HelloWorld.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -force_load /Users/me/Library/Developer/Xcode/DerivedData/HelloWorld-dsvozgctlgpqhxgogbudpossnucy/Build/Products/Debug-iphonesimulator/libCordova.a -ObjC -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.0 -framework AssetsLibrary /Users/me/Library/Developer/Xcode/DerivedData/HelloWorld-dsvozgctlgpqhxgogbudpossnucy/Build/Products/Debug-iphonesimulator/libCordova.a -framework CoreGraphics -framework MobileCoreServices -framework CoreLocation -Xlinker -dependency_info -Xlinker /Users/me/Library/Developer/Xcode/DerivedData/HelloWorld-dsvozgctlgpqhxgogbudpossnucy/Build/Intermediates/HelloWorld.build/Debug-iphonesimulator/HelloWorld.build/Objects-normal/x86_64/HelloWorld_dependency_info.dat -o /Users/me/Library/Developer/Xcode/DerivedData/HelloWorld-dsvozgctlgpqhxgogbudpossnucy/Build/Products/Debug-iphonesimulator/HelloWorld.app/HelloWorld
ld: warning: ignoring file /Users/me/Library/Developer/Xcode/DerivedData/HelloWorld-dsvozgctlgpqhxgogbudpossnucy/Build/Products/Debug-iphonesimulator/libCordova.a, file was built for archive which is not the architecture being linked (x86_64): /Users/me/Library/Developer/Xcode/DerivedData/HelloWorld-dsvozgctlgpqhxgogbudpossnucy/Build/Products/Debug-iphonesimulator/libCordova.a
Undefined symbols for architecture x86_64:
  "_CDVLocalNotification", referenced from:
      -[AppDelegate application:didReceiveLocalNotification:] in AppDelegate.o
  "_CDVPluginHandleOpenURLNotification", referenced from:
      -[AppDelegate application:handleOpenURL:] in AppDelegate.o
  "_OBJC_CLASS_$_CDVCommandDelegateImpl", referenced from:
      _OBJC_CLASS_$_MainCommandDelegate in MainViewController.o
  "_OBJC_CLASS_$_CDVCommandQueue", referenced from:
      _OBJC_CLASS_$_MainCommandQueue in MainViewController.o
  "_OBJC_CLASS_$_CDVViewController", referenced from:
      _OBJC_CLASS_$_MainViewController in MainViewController.o
  "_OBJC_METACLASS_$_CDVCommandDelegateImpl", referenced from:
      _OBJC_METACLASS_$_MainCommandDelegate in MainViewController.o
  "_OBJC_METACLASS_$_CDVCommandQueue", referenced from:
      _OBJC_METACLASS_$_MainCommandQueue in MainViewController.o
  "_OBJC_METACLASS_$_CDVViewController", referenced from:
      _OBJC_METACLASS_$_MainViewController in MainViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

...
ld: warning: ignoring file /Users/me/Library/Developer/Xcode/DerivedData/project/Build/Products/Debug-iphoneos/libCordova.a, missing required architecture arm64 in file /Users/me/Library/Developer/Xcode/DerivedData/project/Build/Products/Debug-iphoneos/libCordova.a (2 slices)
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_CDVPlugin", referenced from:
...
I then started by upgrading sole phonegap but with no result. Then, I had upgraded cordova to the last version, and created a new project and see that the problem has been disappeared.
Current versions at this time are:
$ sudo npm list -g phonegap
/usr/local/lib
└── phonegap 4.2.0-0.24.2 
$ sudo npm list -g cordova
/usr/local/lib
├── cordova@4.3.0 
└─┬ phonegap@4.2.0-0.24.2
  └── cordova@4.2.0 
I had also upgraded ios-sim to the last version (3.1.1 from 1.8.2) using:
sudo npm update -g ios-sim

as well as, just in the case, ios-deploy (1.4.0).

Moreover, according to the guidelines provided bellow, to upgrade and fix the issue, for your old projects, you may do the following:
npm install -g cordova
cd my_project
cordova platform update ios

Updating ios project...
iOS project updated with cordova-ios@3.8.0

Then your project will be ok.

References

Xcode 5.1 (5B130a) build errors
64-bit and iOS 8 Requirements for New Apps
iOS 64-bit Support Now Available on PhoneGap Build
iOS 64-bit apps in Cordova
Apache Cordova iOS 3.7.0