- Home /
ios xcode 8 build error with google adbmob, GADMAdapterAdColony, ld: symbol(s) not found for architecture arm64
Hi folks,
I'm trying to integrate some Rewarded video ads using GoogleAdMob unity plugin. I managed to make the sample work for android by using MAD Reward Mediation sample app, shared somewhere in a google group. Anyway, I was able to build for android and the reward videos are working for AdColony
, Chartboost
and Unity Ads
, but I cannot build it for iOS.
I went on the firebase admob/ios/mediation-networks page and grabbed the ios Adapters for AdColony
, Chartboost
and Unity Ads
, added them to Plugins/iOS/
in my project. I though it was failing to build because of a missing linked AdSupport.framework
so I made sure it was checked in Framework dependencies (it was). I manually added it to the Xcode build too, but it still fails.
Here's the error I get:
ld: warning: arm64 function not 4-byte aligned: ltmp0 from PATH_TO_IOS_BUILD/Libraries/libiPhone-lib.a(unwind_test_arm64.o)
ld: warning: arm64 function not 4-byte aligned: _unwind_tester from PATH_TO_IOS_BUILD/Libraries/libiPhone-lib.a(unwind_test_arm64.o)
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_AdColony", referenced from:
objc-class-ref in libAdapterSDKAdColony.a(GADMAdapterAdColony.o)
objc-class-ref in libAdapterSDKAdColony.a(GADMAdapterAdColonyInitializer.o)
"_OBJC_CLASS_$_Chartboost", referenced from:
objc-class-ref in libAdapterChartboostAds.a(GADMAdapterChartboostSingleton.o)
objc-class-ref in libAdapterChartboostAds.a(GADMAdapterChartboost.o)
"_ADC_SET_USER_GENDER", referenced from:
-[GADMAdapterAdColony addUserMetadata] in libAdapterSDKAdColony.a(GADMAdapterAdColony.o)
"_ADC_USER_MALE", referenced from:
-[GADMAdapterAdColony addUserMetadata] in libAdapterSDKAdColony.a(GADMAdapterAdColony.o)
"_ADC_SET_USER_LATITUDE", referenced from:
-[GADMAdapterAdColony addUserMetadata] in libAdapterSDKAdColony.a(GADMAdapterAdColony.o)
"_ADC_USER_FEMALE", referenced from:
-[GADMAdapterAdColony addUserMetadata] in libAdapterSDKAdColony.a(GADMAdapterAdColony.o)
"_ADC_SET_USER_AGE", referenced from:
-[GADMAdapterAdColony addUserMetadata] in libAdapterSDKAdColony.a(GADMAdapterAdColony.o)
"_CBLocationDefault", referenced from:
-[GADMAdapterChartboost setUp] in libAdapterChartboostAds.a(GADMAdapterChartboost.o)
-[GADMAdapterChartboost requestRewardBasedVideoAd] in libAdapterChartboostAds.a(GADMAdapterChartboost.o)
-[GADMAdapterChartboost getInterstitial] in libAdapterChartboostAds.a(GADMAdapterChartboost.o)
"_ADC_SET_USER_LONGITUDE", referenced from:
-[GADMAdapterAdColony addUserMetadata] in libAdapterSDKAdColony.a(GADMAdapterAdColony.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Showing first 200 warnings only
I'm building with Xcode Version 8.1 (8B62)
. My build architectures are armv7, arm64
. I do have $(inherited)
flag in Other Linker Flag
like in this undefined-symbols-for-architecture-arm64 StackOverflow question.
This is what I have in my Podfile
:
target 'Unity-iPhone' do
pod 'GooglePlayGames', '5.1'
pod 'Google-Mobile-Ads-SDK', '~> 7.8'
pod 'GoogleSignIn', '~> 2.2.0'
end
Without the added adapters, it does build, but it fails to display the ads. I'll try to isolate the problem in a separate project to see if it's related to something else than the ads adapters.
Answer by JRobichaud · Nov 16, 2016 at 07:40 PM
Add AdMob Library in the Xcode project. You included only the AdMob Adapter Library.
You can validate if an architecture is available in a library using the unix command "file".
I ran "file" on the adapters an I confirm they are arm64.
Answer by GabLeRoux · Nov 17, 2016 at 05:41 AM
Thanks @jrobichaud, that was indeed the cause of the errors concerning "_OBJC_CLASS_$_AdColony"
and "_OBJC_CLASS_$_Chartboost"
I didn't like the idea of manually adding .framework files to the xcode project so I used cocoapod to install the SDKs.
I was able to compile by adding the following to my Pofile
:
target 'Unity-iPhone' do
pod 'GooglePlayGames', '5.1'
pod 'Google-Mobile-Ads-SDK', '~> 7.8'
pod 'GoogleSignIn', '~> 2.2.0'
pod 'UnityAds', '~> 1.5'
pod 'AdColony', '~> 2.6.2'
pod 'ChartboostSDK', '~> 6.5'
end
I first tried with pod 'AdColony', '~> 3.0.0'
, but it was failing with the same
"_ADC_SET_USER_GENDER", referenced from:
-[GADMAdapterAdColony addUserMetadata] in libAdapterSDKAdColony.a(GADMAdapterAdColony.o)
"_ADC_USER_MALE", referenced from:
-[GADMAdapterAdColony addUserMetadata] in libAdapterSDKAdColony.a(GADMAdapterAdColony.o)
"_ADC_SET_USER_LATITUDE", referenced from:
-[GADMAdapterAdColony addUserMetadata] in libAdapterSDKAdColony.a(GADMAdapterAdColony.o)
"_ADC_USER_FEMALE", referenced from:
-[GADMAdapterAdColony addUserMetadata] in libAdapterSDKAdColony.a(GADMAdapterAdColony.o)
"_ADC_SET_USER_AGE", referenced from:
-[GADMAdapterAdColony addUserMetadata] in libAdapterSDKAdColony.a(GADMAdapterAdColony.o)
"_CBLocationDefault", referenced from:
-[GADMAdapterChartboost setUp] in libAdapterChartboostAds.a(GADMAdapterChartboost.o)
-[GADMAdapterChartboost requestRewardBasedVideoAd] in libAdapterChartboostAds.a(GADMAdapterChartboost.o)
-[GADMAdapterChartboost getInterstitial] in libAdapterChartboostAds.a(GADMAdapterChartboost.o)
"_ADC_SET_USER_LONGITUDE", referenced from:
-[GADMAdapterAdColony addUserMetadata] in libAdapterSDKAdColony.a(GADMAdapterAdColony.o)
I found this obscure post which basically says to use 2.6.2
which allowed me to compile :)
Sadly, the same code that works on Android is failing on ios when it comes to loading the rewardbased video in the background. (app crashes), also crashes after showing an Interstitial. Cool thing is I have a clear message in xcode console now:
<Google> Cannot find an ad network adapter with the name(s): GADMAdapterUnity. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.
HandleRewardBasedVideoFailedToLoad event received with message: Failed to receive ad with error: No ad returned from any ad server.
GoogleMobileAdsController:HandleRewardBasedVideoFailedToLoad(Object, AdFailedToLoadEventArgs)
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)
libc++abi.dylib: terminating with uncaught exception of type Il2CppExceptionWrapper
I suppose that even tho the app succeeds to build and that the SDKs are installed with cocoapod, I probably have to link them somehow.
There is this post that has a similar error and it would be that the sdk isn't correctly linked (I suppose it's the case).
I tried on a blank project (faster to build). Turned out that there are many things that needs to be done manually (sadly).
I had the following error:
ld: library not found for -liPhone-lib
The cocoapod version of the UnityAds is too old. Solution, manually grab the 2.0.x version as described in the instructions and link it manually (seriously I mean 2016 and we're still doing drag n drop shits?) According to the readme of the UnityAds adapter, it requires Unity Ads SDK to v2.0.4 and the cocoapod version installs 1.5 so remove that and link the framework file. Worked for me this time and I saw ads from each of the providers.
tldr; read integration readmes, cocoapods is cool, but may bot work for every integrations, better to test one after the other for easier debugging.
March 2017 edit AdColony removed 2.6.2
version and I can't build anymore. Installing using latest version could solve the problem:
pod 'AdColony', '~> 3.1'
but I'm still fighting with it, I may have to update the Adapter too.
Your answer
Follow this Question
Related Questions
Can I modify codes using Xcode after creating the app using Unity3d? 1 Answer
How to add Google Admob SDK for iOS in Unity editor (instead to do it manually in XCode)? 0 Answers
How to get readable stacktrace in IOS build? 1 Answer
IOS conversion Xcode not launching 0 Answers
Unity iOS build error 0 Answers