linker errors when integrating admob sdk into iOS app - ios

I integrated Google's AdMob SDK into a working iPhone app. I'm getting 12 errors that all start with 'Apple Mach-O Linker (Id) Error'. The text of the error messages typically refer to a low level objective C object called from a google library. For example:
Undefined symbols for architecture i386:
"_NSInMemoryStoreType", referenced from:
anon in libGoogleAnalytics.a(GAIDataStore.o)
+[GAIDataStore memoryContextWithModel:withError:] in libGoogleAnalytics_debug.a(GAIDataStore.o)
I thought I might not be linking a necessary framework but that all seems to be in order. I followed the instructions at https://developers.google.com/mobile-ads-sdk/docs/ and my linked libraries tab looks like this:
Unless I'm mistaken, it includes the frameworks that AdMob needs. Any suggestions much appreciated.

You probably just included the "add-ons" folder wholesale. Unfortunately that folder also includes the Google Analytics example project and binary. If you're not using analytics from there, I would remove the entire "GoogleAnalyticsiOS_2.0beta2" folder.

Related

"Undefined symbols for architecture arm64" appearing after Unity FB SDK Update

Unity Version: 2020.3.25f1
XCode Version: 13.2.1
Unity FB SDK: Migrating from 11.+ to 14.0.0
After resisting updating the Facebook Unity SDK due to editor/ide related issues introduced in 13.2, was working to update to Unity Facebook SDK version 14.0.0. After resolving the standard issues to be in compliance with FB's updates (including client token in the FB Settings specifically and setting the DLLs to the correct build architecture), I had been able to build webgl and android without issue, but have encountered an iOS build fail.
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_ACAccountStore", referenced from:
objc-class-ref in Util.o
"_ACFacebookAppIdKey", referenced from:
_Util_getNativeFBPermissionStatus in Util.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Reading through the various other issues hitting a similar Undefined symbols for architecture blah makes me think I might either be missing something in my linker settings, or potentially missing a framework I need to reference. Originally I had assumed it was something happening during archiving, but the same error shows when just trying to build the xcode project. The pod file builds successfully and resolves without issue, so the xcode workspace is being built.
EDIT: Adding a little more info, I had already done the dll import settings solution suggested.
This is solved by: https://github.com/facebook/facebook-sdk-for-unity/wiki/FAQ---Troubleshooting-Unity-SDK-14.0.0
Your issue is "Issue 2: dlls misconfiguration"--for completion's sake, below is the solution in its entirety. I'm leaving the misspellings and bad grammar below just to emphasize how sloppy these guys are.
"Solution:
This is an indication of mis-configuration of dlls in Unity. When Unity SDK is imported into Unity, unfortunately Unity reconfigures all dlls to 'All Platforms' and this causes an issue when building on a particular platform. The way to resolve this, is to reconfigure the dlls. You will find them in Unity under FacebookSDK -> Plugins and all the dlls are under their various platform folders such as Android / Canvas / Editor / iOS etc. Click on them and an inspector will appear (attached screenshot). The example attached shows the configuration for an Android dll. Uncheck All Platforms (if needed) and select Android. Do the same for the rest:
Android.DLL to Android platform
IOS Dll to iOS platform
Canavs to webgl"
Edit: As noted additionally below if you aren't building for Windows (or any of the other platforms), just delete those folders. Regardless you will HAVE to delete the Windows x86 folder if you want your build to work on mobile.
After getting some input from an engineer that had worked on this project in the past, managed to find that the missing symbol was related to some old FB Code no longer supported, and it was not in use by our app anymore. Because of this, was able to cleanly remove the old code and resolve the build issue. Things appeared to be working as intended. For visibility, we had an internal class using some extern methods to bridge between our app code and the native code pertaining to platform. iOS had a method getNativeFBPermissionStatus that was part of a Util.m class.

Error using Google Maps in IOS?

I am creating a mapView in iOs, using Google Maps Api.
I did it by referring this link
Document
And I am getting few errors like
Undefined symbols for architecture i386:
"_objc_setProperty_nonatomic", referenced from:
-[GMSx_PBGeneratedMessage setExtensionRegistry:] in GoogleMaps(ProtocolBuffers.o)
I am fed up with this, can anybody kindly help with this.
I think Kalpesh was on the right track with his comment. Your screenshot shows you as running with the iOS 5.1 simulator, but the current version of the maps iOS SDK requires iOS 6.0 or newer.
My answer which Kalpesh linked to explains this in more detail:
google map on iphone exception
I noticed you commented on that other answer though, so which version of the SDK are you using?
The errors you see are linker errors telling you that the symbols are not available for the simulator architecture (i386).
You are not linking a simulator-compatible version of the library (or perhaps you missed the step of adding the library to your project to be linked).
I don't know the Google Maps SDK, but it is possible that it doesn't have a simulator-compatible binary within the library file.

mach-o linker error with Facebook ios sdk 3.7 when used in static lib

I'm using Facebook SDK 3.7 in an iOS static library project isolating core functionality for various apps. It's a nice improvement in the SDK that you no longer have to manually include dependent frameworks. However, the end project that uses the static lib throws Mach-O linker errors when building. Manually adding the frameworks from this link (https://developers.facebook.com/docs/ios/upgrading-from-3.5-to-3.6/) fixes it.
Is there some change that can be made (to their build scripts, to project settings?) to avoid needing to do this in this scenario?
Linker Errors
Undefined symbols for architecture i386: "_ACFacebookAppIdKey", referenced from:
-[FBSystemAccountStoreAdapter requestAccessToFacebookAccountStore:defaultAudience:isReauthorize:appID:session:‌​handler:]
in FacebookSDK(FBSystemAccountStoreAdapter.o) "_ACFacebookAudienceEveryone", referenced from:" ...
You still need to link against the Accounts.framework:

Upgrading Google Mobile Ads iOS SDK from 5.0.5 to 6.4.2 results in linker errors

I have an existing iOS app that is using Google Mobile Ads SDK (v 5.0.5, I believe). I need to upgrade it to the latest version for DoubleClick support. However, I'm getting linker errors.
My steps were as follows:
Remove file references for previous SDK from project
Remove previous libGoogleAdMobAds.a linked library
Follow the setup instructions (to the letter, including the required frameworks, including only the specific files, as well as adding the Other Linker Flag)
The specific error is:
Undefined symbols for architecture i386:
"_CGSizeFromGADAdSize", referenced from
or
"_kGADAdSizeBanner", referenced from
What else am I missing?
Maybe you need the -all_load linker flag option too? According to this article it's obsolete for newer ARM7 targets, but perhaps you have an old target?
http://vntin.com/feeds.feedburner.com/blogspot/LTiVe
See under this section: "Support for armv7s"
"If you’re targeting the armv7s architecture, you will not need to add the -all_load linker flag to your projects anymore. "
[Update]
You can try to verify what's in the lib*.a file by using the nm command.
nm -U libGoogleAdMobAds.a | grep kGADAdSizeBanner
Also, clicking on the Log Navigator may provide some additional information. Select the last icon then your last build in the left nav.
[Update 2]
Someone on this site also complained about a linker problem with the new API. Might have to make small changes to your code.
http://www.monkeycoder.co.nz/Community/posts.php?topic=1246
Something has changed in the latest AdMob SDK. I get the same linker error. I can use an older version of the SDK and this all works fine. Anyone know what could have changed with Ad sizes?
EDIT: Found the problem. There were some name changes to constants :)
https://developers.google.com/mobile-ads-sdk/docs/ios/intermediate
Change the GAD_ ad sizes with:
kGADAdSizeBanner.size.width and kGADAdSizeBanner.size.height

Error while integrating Google Analytics SDK (GoogleAnalyticsiOS_2.0beta4) in my iOS app

I am getting following error
duplicate symbol _OBJC_METACLASS_$_GAIDispatcher in:
/Shared/ThirdParty/Analytics/libGoogleAnalytics.a(GAIDispatcher.o)
/Shared/ThirdParty/Analytics/libGoogleAnalytics_debug.a(GAIDispatcher.o)
ld: 212 duplicate symbols for architecture armv7 clang: error:
linker command failed with exit code 1 (use -v to see invocation)
I am using coredata in my app and I have linked all the frameworks as mentioned in the doc.
Also, I am compiling my app using Xcode 4.5.2.
A possible duplicate Qs could be (The Google Analytics SDK for iOS isn't built for the armv7s architecture while instaling app on iPhone) .
But, I am not using Analytic v1.5.1. I am using version 2(beta).
The problem you're seeing is because you have two Google Analytics libraries being included in your built product. The non-Debug version and the Debug version.
You need to settle on and simply use one of them. Take the non-used one out of your project or uncheck the target's "membership" checkbox in the file inspector for that unwanted library.
The checkbox I'm talking about is seen below. Instead of "UIKit.framework" (which I quickly selected to make this example), look for one of the two Google Analytics libraries and turn it off.

Resources