Issues updating Phonegap iOS app for 64-bit architecture - ios

I have a phonegap app with many plugins that runs fine on iOS devices. However, I am currently using $(ARCHS_STANDARD_32_BIT) for architectures in xcode, and now believe I need to update it to be $(ARCHS_STANDARD) in the architecture setting and to include arm64 as a valid architecture per Apple's Feb 1, 2015 requirements.
When I try to run the project on an iPhone 6, I get 16 errors now, copied below. 2 questions:
1) Do I need to use the archs_standard and arm64 changes mentioned in the 1st paragraph?
2) How do I fix these issues so I can submit my app? Is it all issues with individual plugins I'm using? Do I need to find an updated version (or update myself) every plugin listed in the errors or is the issue related to something else? I don't see updates for 64-bit on a few of the plugins I've looked at, so not sure if this is what the issue is. I'm not very familiar with Obj C so appreciate any help here!
Thanks in advance for any help!
Error messages:
Undefined symbols for architecture arm64:
"_CDVPageDidLoadNotification", referenced from:
-[CDVSplashScreen pluginInitialize] in CDVSplashScreen.o
"_OBJC_CLASS_$_CDVInvokedUrlCommand", referenced from:
objc-class-ref in CDVFile.o
"_OBJC_METACLASS_$_CDVCommandQueue", referenced from:
_OBJC_METACLASS_$_MainCommandQueue in MainViewController.o
"_OBJC_CLASS_$_CDVPlugin", referenced from:
_OBJC_CLASS_$_CDVLocation in CDVLocation.o
_OBJC_CLASS_$_FacebookConnectPlugin in FacebookConnectPlugin.o
_OBJC_CLASS_$_IonicKeyboard in IonicKeyboard.o
_OBJC_CLASS_$_CDVInAppBrowser in CDVInAppBrowser.o
_OBJC_CLASS_$_APPEmailComposer in APPEmailComposer.o
_OBJC_CLASS_$_CDVStatusBar in CDVStatusBar.o
_OBJC_CLASS_$_CDVVibration in CDVVibration.o
...
"_OBJC_METACLASS_$_CDVViewController", referenced from:
_OBJC_METACLASS_$_MainViewController in MainViewController.o
"_CDVLocalNotification", referenced from:
-[AppDelegate application:didReceiveLocalNotification:] in AppDelegate.o
"_OBJC_CLASS_$_CDVViewController", referenced from:
l_OBJC_$_CATEGORY_CDVViewController_$_StatusBar in CDVStatusBar.o
_OBJC_CLASS_$_MainViewController in MainViewController.o
objc-class-ref in CDVFile.o
"_OBJC_METACLASS_$_CDVCommandDelegateImpl", referenced from:
_OBJC_METACLASS_$_MainCommandDelegate in MainViewController.o
"_OBJC_CLASS_$_CDVWebViewDelegate", referenced from:
objc-class-ref in CDVInAppBrowser.o
"_OBJC_CLASS_$_CDVCommandQueue", referenced from:
_OBJC_CLASS_$_MainCommandQueue in MainViewController.o
"_OBJC_CLASS_$_CDVUserAgentUtil", referenced from:
objc-class-ref in CDVInAppBrowser.o
"_CDVPluginHandleOpenURLNotification", referenced from:
-[AppDelegate application:handleOpenURL:] in AppDelegate.o
-[CDVInAppBrowser openInSystem:] in CDVInAppBrowser.o
"_OBJC_CLASS_$_CDVCommandDelegateImpl", referenced from:
_OBJC_CLASS_$_MainCommandDelegate in MainViewController.o
"_OBJC_CLASS_$_CDVPluginResult", referenced from:
objc-class-ref in CDVLocation.o
objc-class-ref in FacebookConnectPlugin.o
objc-class-ref in CDVInAppBrowser.o
objc-class-ref in APPEmailComposer.o
objc-class-ref in CDVStatusBar.o
objc-class-ref in CDVLocalFilesystem.o
objc-class-ref in PushPlugin.o
...
"_OBJC_METACLASS_$_CDVPlugin", referenced from:
_OBJC_METACLASS_$_CDVLocation in CDVLocation.o
_OBJC_METACLASS_$_FacebookConnectPlugin in FacebookConnectPlugin.o
_OBJC_METACLASS_$_IonicKeyboard in IonicKeyboard.o
_OBJC_METACLASS_$_CDVInAppBrowser in CDVInAppBrowser.o
_OBJC_METACLASS_$_APPEmailComposer in APPEmailComposer.o
_OBJC_METACLASS_$_CDVStatusBar in CDVStatusBar.o
_OBJC_METACLASS_$_CDVVibration in CDVVibration.o
...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

1) Do I need to use the archs_standard and arm64 changes mentioned in
the 1st paragraph?
Yes, you have to use $(ARCHS_STANDARD) and arm64 if you want to submit the app to the stores.
2) How do I fix these issues so I can submit my app? Is it all issues
with individual plugins I'm using? Do I need to find an updated
version (or update myself) every plugin listed in the errors or is the
issue related to something else? I don't see updates for 64-bit on a
few of the plugins I've looked at, so not sure if this is what the
issue is. I'm not very familiar with Obj C so appreciate any help
here!
The plugins are fine, the problem is the cordovaLib project. You have to change the cordovaLib project to $(ARCHS_STANDARD) too and rebuild the libCordova.a, or even better, use a cordova version greater than 3.4 that will include the 64 bits support.
EDIT:
More details from the link manihiki provided:
You will need to update the Build Settings in your project. The steps are mentioned in the issue and reproduced below:
//Update build settings for your project
Select your Project icon Choose Build Settings.
For “Architectures”, select $ARCHS_STANDARD – Standard architectures (armv7, armv7s, arm64)
For “Valid Architectures”, add “arm64″
//Update build settings for cordovaLib project
Select your CordovaLib.xcodeproj icon
In the Build Settings for the Project (not Target), delete *all* the conditional architecture settings (hover to see the minus sign). This is what is recommended by Apple in their Xcode 5.1 Release Notes.
For “Architectures”, select $ARCHS_STANDARD – Standard architectures(armv7, armv7s, arm64)
For “Valid Architectures”, add “arm64″
//Update build settings for the Target
In the Build Settings for the Target, delete *all* the conditional architecture settings (hover to see the minus sign).
For “Architectures”, select $ARCHS_STANDARD – Standard architectures (armv7, armv7s, arm64)
For “Valid Architectures”, add “arm64″
Some plugins might not work, you have to made this changes
On CordovaLib/Classes/CDVCommandQueue.m
change this
objc_msgSend(obj, normalSelector, command);
to this
((void (*)(id, SEL, id))objc_msgSend)(obj, normalSelector, command);
and on CordovaLib/Classes/CDVViewController.m
change this
if ((BOOL)objc_msgSend(plugin, selector, request, navigationType) == YES)
to this:
if (((BOOL (*)(id, SEL, id, int))objc_msgSend)(plugin, selector, request, navigationType) == YES)
All the details can be found here https://shazronatadobe.wordpress.com/2014/03/12/xcode-5-1-and-cordova-ios/

I inherited a legacy PhoneGap/Cordova app and received many similar errors when changing the Architecture Build Setting to $(ARCHS_STANDARD).
I was able to successfully build after updating (removing and then adding) two PhoneGap plugins (out of nine total), and removing/adding the PhoneGap iOS platform each time. Specifically, the plugins were com.phonegap.plugins.barcodescanner and org.apache.cordova.geolocation. I targeted those two plugins by googling the classnames in the errors and determining which plugins they related to.
To "update" a plugin:
cordova plugin rm com.phonegap.plugins.barcodescanner
cordova plugin add com.phonegap.plugins.barcodescanner
To remove/add the PhoneGap/Cordova ios platform:
cordova platform remove ios
cordova platform add ios

Related

Installing the segment-iOS analytics-iOS in xcode manually

I am trying to add analytics-iOS manually by directly adding the Analytics folder to the project making it as a group, after adding when I try to build the project I get error as "Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_SKProductsRequest", referenced from:
objc-class-ref in SEGStoreKitTracker.o
"_OBJC_CLASS_$_SKPaymentQueue", referenced from:
objc-class-ref in SEGStoreKitTracker.o "
and other 6 errors
I was able to solve this. There was a dependency on StoreKit framework which i had to add in Link Binaries with Libraries in Build Phase.

CocoaPods AmazonMobileHub Undefined symbols for architecture x86_64

I have a cocoa pods Swift project and Im trying to install the Amazon AWS Mobile Hub frameworks, copied the Sdks and the MobileHubHelper framework but is not building.
The error goes like this:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_AWSLambdaInvoker", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSCloudLogic.o)
"_OBJC_CLASS_$_AWSS3", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSContentManager.o)
(maybe you meant: _OBJC_CLASS_$_AWSS3ContentProvider)
"_OBJC_CLASS_$_AWSS3GetPreSignedURLRequest", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSContentManager.o)
"_OBJC_CLASS_$_AWSS3ListObjectsOutput", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSContentManager.o)
"_OBJC_CLASS_$_AWSS3ListObjectsRequest", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSContentManager.o)
From what I found it looks like it is not encourage to use the public SDKs with the mobile hub framework but to copy the ones given with the sample app but either way it does not work.
Any ideas will be appreciated.
Thanks!
Turns out that if you go to the Pods folder in your project and update the Pods-.debug.xcconfig and Pods-.release.xcconfig OTHER_LDFLAGS by removing the -ObjC param after ($inherited) the project builds and run.
Have you added $(inherited) to Other Linker Flags? Check by clicking on your project -> build settings -> type in the search bar: Other linker flags and expand Debug and on the right side where you'll see some paths, click on that and set it to $(inherited). Should work.

Apple Mach O Linker Errors trying to build Unity App for the iPhone Simulator

So I have this Unity App that I'm trying to test in the iOS Simulator. I selected the simulator sdk in Unity before building. I already have the android version of the app released in the play store.
Anyway, I can't get it to build in Xcode. I keep getting these 3 build errors:
ld: warning: ignoring file /Users/myaccount/Desktop/untitled
folder/Libraries/libChartboost.a, missing required architecture i386 in file
/Users/danmelamed/Desktop/untitled folder/Libraries/libChartboost.a (2 slices)
ld: warning: ignoring file /Users/myaccount/Desktop/untitled
folder/Libraries/libSoomlaIOSStore.a, missing required architecture i386 in file
/Users/myaccount/Desktop/untitled folder/Libraries/libSoomlaIOSStore.a (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CBAnalytics", referenced from:
objc-class-ref in ChartBoostBinding.o
"_OBJC_CLASS_$_Chartboost", referenced from:
objc-class-ref in ChartBoostBinding.o
objc-class-ref in ChartBoostManager.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
"_OBJC_CLASS_$_CBAnalytics", referenced from:
objc-class-ref in ChartBoostBinding.o
"_OBJC_CLASS_$_Chartboost", referenced from:
objc-class-ref in ChartBoostBinding.o
objc-class-ref in ChartBoostManager.o
ld: symbol(s) not found for architecture i386
How would I get chartboost to run in the simulator architecture? or if not, how can I disable chartboost so that I could test my app without it? I don't own any iOS devices. So I can only test on simulator.
I also tried to get the regular sdk build in Unity running in Xcode and I got different errors that I would need to deal with as well. I got 12 errors of Apple Mach O Linkers:
Undefined symbols for architecture armv7:
"_iosLogin", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosLogout", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosInit", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosSetShareDialogMode", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosFeedRequest", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosAppRequest", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosFBSettingsPublishInstall", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosFBAppEventsSetLimitEventUsage", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosGetDeepLink", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosFBAppEventsLogPurchase", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_iosFBAppEventsLogEvent", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What could it be?
The common causes for "Undefined symbols for architecture armv7" are:
You import a header and do not link against the correct library. This is common, especially for headers for libraries like QuartzCore since it is not included in projects by default. To resolve:
Add the correct libraries in the Link Binary With Libraries section of the Build Phases.
If you want to add a library outside of the default search path you can include the path in the Library Search Paths value in the Build Settings and add
-l{library_name_without_lib_and_suffix} (eg. for libz.a use -lz) to the Other Linker Flags section of Build Settings.
You copy files into your project but forgot to check the target to add the files to. To resolve:
Open the Build Phases for the correct target, expand Compile Sources and add the missing .m files.
You include a static library that is built for another architecture like i386, the simulator on your host machine. To resolve:
If you have multiple library files from your libraries vendor to include in the project you need to include the one for the simulator (i386) and the one for the device (armv7 for example).
Optionally, you could create a fat static library that contains both architectures.
Also try this
Remove Build Active Architecture Only (build setting parameter key is 'ONLY_ACTIVE_ARCH') from all of your static libraries' project build settings or overwrite it with 'NO'

Xcode 5 and phonegap: linker errors on building for device but not for simulator

Our phonegap app builds fine for the iphone simulator but generates linker errors when building the app on an iphone. the only thing that changed was installing testflight and a test app.
We already removed testflight and the test app, but the linker errors remain.
Any ideas on how to fix this?
We're on xcode 5 and phonegap 3.4.
Errors:
ld: warning: ignoring file /Users/c/Library/Developer/Xcode/DerivedData/s-fhgxmhdprdjvwahdbgwuagoragit/Build/Products/Debug-iphoneos/libCordova.a, file was built for archive which is not the architecture being linked (arm64): /Users/c/Library/Developer/Xcode/DerivedData/s-fhgxmhdprdjvwahdbgwuagoragit/Build/Products/Debug-iphoneos/libCordova.a
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_CDVWebViewDelegate", referenced from:
objc-class-ref in CDVInAppBrowser.o
"_OBJC_METACLASS_$_CDVViewController", referenced from:
_OBJC_METACLASS_$_MainViewController in MainViewController.o
"_OBJC_CLASS_$_CDVPlugin", referenced from:
_OBJC_CLASS_$_CDVDevice in CDVDevice.o
_OBJC_CLASS_$_CDVConnection in CDVConnection.o
_OBJC_CLASS_$_LowLatencyAudio in LowLatencyAudio.o
_OBJC_CLASS_$_CDVLogger in CDVLogger.o
_OBJC_CLASS_$_CDVInAppBrowser in CDVInAppBrowser.o
_OBJC_CLASS_$_InAppPurchase in InAppPurchase.o
"_OBJC_METACLASS_$_CDVPlugin", referenced from:
_OBJC_METACLASS_$_CDVDevice in CDVDevice.o
_OBJC_METACLASS_$_CDVConnection in CDVConnection.o
_OBJC_METACLASS_$_LowLatencyAudio in LowLatencyAudio.o
_OBJC_METACLASS_$_CDVLogger in CDVLogger.o
_OBJC_METACLASS_$_CDVInAppBrowser in CDVInAppBrowser.o
_OBJC_METACLASS_$_InAppPurchase in InAppPurchase.o
"_OBJC_CLASS_$_CDVViewController", referenced from:
_OBJC_CLASS_$_MainViewController in MainViewController.o
objc-class-ref in CDVDevice.o
"_CDVLocalNotification", referenced from:
-[AppDelegate application:didReceiveLocalNotification:] in AppDelegate.o
"_OBJC_METACLASS_$_CDVCommandDelegateImpl", referenced from:
_OBJC_METACLASS_$_MainCommandDelegate in MainViewController.o
"_OBJC_CLASS_$_CDVPluginResult", referenced from:
objc-class-ref in CDVDevice.o
objc-class-ref in CDVConnection.o
objc-class-ref in LowLatencyAudio.o
objc-class-ref in CDVInAppBrowser.o
objc-class-ref in InAppPurchase.o
"_OBJC_CLASS_$_CDVCommandDelegateImpl", referenced from:
_OBJC_CLASS_$_MainCommandDelegate in MainViewController.o
"_OBJC_CLASS_$_CDVUserAgentUtil", referenced from:
objc-class-ref in CDVInAppBrowser.o
"_OBJC_CLASS_$_CDVCommandQueue", referenced from:
_OBJC_CLASS_$_MainCommandQueue in MainViewController.o
"_OBJC_METACLASS_$_CDVCommandQueue", referenced from:
_OBJC_METACLASS_$_MainCommandQueue in MainViewController.o
"_CDVPluginHandleOpenURLNotification", referenced from:
-[AppDelegate application:handleOpenURL:] in AppDelegate.o
-[CDVInAppBrowser openInSystem:] in CDVInAppBrowser.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This kind of problems occur while updating your Xcode but any third party tool you are using may not be updated with this architecture armv64.
So Click on your Project Navigator from XCode.
Click On Targets from your Project and click on BuildSettings from it.
Find Valid Architectures in it.
Just double click on that and remove armv64 from that.
Make sure there is armv7 and armv7s only.
In my case this worked for me.
Clean and build your project. It should work fine now.
Hope it helps you.
EDIT
Now, as of Feb 1st 2015, apple will not allow apps without arm64 architecture supported.
So make sure that all the apps submitted have arm64 support.
seems like we also unintentionally upgraded to xcode 5.1, causing the problem. phonegap 3.4 and xcode 5.1 are incompatible unless you make some changes.
here is the solution: http://shazronatadobe.wordpress.com/2014/03/12/xcode-5-1-and-cordova-ios/
Sorry if this might seem like a trite answer, but the following steps are usually what I always do when I see linker errors :
Ensure your code is up to date, with all the latest fixes and versions.
Make sure you update your submodules. In git : git submodule update --init --recursive
Please do a Clean Build Folder : Go to Product, Hover on Clean and press together (Command + Option) and click on "Clean Build Folder".
Rinse and Repeat.
In case you have any modules that are not being references correctly, head over to your Build Phases, REMOVE the modules that are troubling you and re-add them.

phonegap cordova xcode link failed when build to 64bit

i have a cordova project in xcode 5.0.2 it works perfectly on a iphone5c but didnt work on iphone5s
i read some on this and thought that the problem is i have to build my project on 64bit architecture.
i make this build settings:
architecture - standart architecture (including 64-bit)(armv7, armv7s, arm64)
build active architecture only - no
and when i build i get this errors:
ld: warning: ignoring file /Users/chana/Library/Developer/Xcode/DerivedData/Pitaron- echagbyhunbeprbdfodckoblgtuq/Build/Products/Debug-iphonesimulator/libCordova.a, file was built for archive which is not the architecture being linked (x86_64): /Users/chana/Library/Developer/Xcode/DerivedData/Pitaron-echagbyhunbeprbdfodckoblgtuq/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)
any body knows what to do?
thanks a lot.
The problem is with Xcode 5.1 coming with 64 bit support.
The cordova project created contains cordova library (‘CordovaLib.xcodeproj’ project in the project navigator pane) which is not configured for arm64.
To resolve this issue, click on ‘CordovaLib.xcodeproj’ where it shows project settings goto ‘Architectures’ and table and change all architectures to ‘$(ARCHS_STANDARD)’ or Standard Architectures. (They have been initially set to different values which is the reason for build failing)
The problem seems to be that your version of libCordova isn't compiled for arm64.
The quick fix is to remove arm64 from your list of build architectures - the 5s will happily run code compiled for armv7.
The proper fix is to upgrade Cordova to a version that has arm64 versions of the libraries compiled.

Resources