Archiving fails due to undefined Symbols for Google Analytics - ios

I have integrated GAI using the most recent cocoapods version.
When I build in the Debug config everything runs just fine.
However, as soon as I try to archive the Application the compiler fails with the following messages:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_GAIDictionaryBuilder", referenced from:
objc-class-ref in libWLCore.a(WLTrackingHelper.o)
"_OBJC_CLASS_$_GAI", referenced from:
objc-class-ref in libWLCore.a(WLTrackingHelper.o)
"_kGAIScreenName", referenced from:
+[WLTrackingHelper trackView:] in libWLCore.a(WLTrackingHelper.o)
+[WLTrackingHelper resetView] in libWLCore.a(WLTrackingHelper.o)
"_kGAIAnonymizeIp", referenced from:
+[WLTrackingHelper prepareDefaultTracker:withAnonymization:withUnCaughtExceptions:withDebug:] in libWLCore.a(WLTrackingHelper.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Since it works in Debug I tried to figure out where the difference in the configuration between Debug and Release lies.
I found out that the Other linker flags in Release are empty whereas in Debug contains the flag for GoogleAnalytics and other frameworks and libraries.
After adding the flags to the Release Configuration of Other linker flags I got
library not found for -lGoogleAnalyticsServices
After that, I added libPods and after that libPods-GoogleAnalytics to the Link Binary With Libraries section but the errors remained the same.
I invested almost 2 days into that problem, but I could not find any solution.

After some fiddling I found the solution by adding not the library generated by cocoa pods (libPods-GoogleAnalytics), but directly linking the libGoogleAnalyticsServices to my main project. Still, I think this is not the most elegant solution possible since the linker should know that the symbols he was missing were available already, as provided by cocoapods.

Please confirm you have added $(inherited) to Other Linker Flags (Build Settings) as in the below image. Add the same in Release also, otherwise the same error will pop up at the time of archiving.

Related

MLKit iOS: Undefined symbols for architecture armv7

I have been trying to integrate MLKit into CardIO using cocoapod. I fixed all the warnings by cocoapod and CardIO was built successfully. However, when I link CardIO to my app and build, this error comes out. I searched all over the internet and tried different kind of approaches suggested by people but still to no avail. Is there any step or setting I might have missed during integration/linking?
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_FIRVisionImage", referenced from:
objc-class-ref in libCardIO.a(CardIOView.o)
"_OBJC_CLASS_$_FIRVision", referenced from:
objc-class-ref in libCardIO.a(CardIOView.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I added $(inherited) in Other Linker flags, Header search paths, Framework search Paths, Library search Paths in "Target -> Build Settings" resolved the issue! Happy Coding!

ParseFacebookUtil: Apple Mach-O Linker, undefined symbol for architecture x86_64 PFDateFormatter

Error occurs after adding the ParseFacebookUtil
ERROR MESSAGE
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_PFDateFormatter", referenced from:
objc-class-ref in ParseFacebookUtils(PFFacebookAuthenticationProvider.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
FRAMEWORKS
I am using XCode 6.2
Thanks
edit:
I've added the frameworks social, and accounts. Same error still occurs.
I ended up fixing this issue by deleting the Parse and Bolts framework, and re adding it back into the project.
Edit:
The best solution to this issue is by using cocoapods. It handles the dependencies better than manually dragging in the framework files.

cocoapods linker error when i added it to my project

i'm using cocoapods for the first time and after everything goes well
i get to run my project that was always wor˚ and got those 2 errors in lin˚er
can anyone please tell me what is it
than˚s
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_PECropViewController", referenced from:
objc-class-ref in addProductViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The addProductViewController object is not found and it was referenced within AppDelegate. You do not link addProductViewController into your app. Check if your Compile Sources section within the Build Phases of your project shows addProductViewController.m
than˚s every body for your help
the problem was with arm 64 i just added it in my target and everything work fine
in architectures filed add standard architectures armv7,arm64

Google Analytics linker error without AdSupport.framework

I'm trying to build my iOS project which includes Google Analytics 3.03a. I've followed all the instructions about using the -force_load linker flags, but unless I include the AdSupport framework I always end up getting this error message when doing my debug build:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_ASIdentifierManager", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(TAGAdvertiserId.o)
objc-class-ref in libGoogleAnalyticsServices.a(TAGAdvertisingTrackingEnabledMacro.o)
objc-class-ref in libGoogleAnalyticsServices.a(TAGMobileAdwordsUniqueIdMacro.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If I try it for my release build I get the same error but for the armv7 architecture.
Everything I'm reading tells me that if I do include the AdSupport framework then my app will get rejected, since I'm not serving ads, so I'm at a loss to know what to do.
This happens both with my actual project, and with a totally new blank test project that literally has no other linker flags:
OTHER_LDFLAGS = -force_load ${PROJECT_DIR}/GoogleAnalytics/libGoogleAnalyticsServices.a
I'm not using the Tag Manager at all, as far as I know.
Add the framework as optional. I submitted apps with Google Analytics without problems.

libcurl linker error on Xcode5 but working fine on Xcode 4.6

I have a project which uses libcurl.all.a. It builds, links and runs perfectly on Xcode 4.6.3. But in Xcode5, it throws linker errors on undefined symbols. The error log is as follows.
Undefined symbols for architecture i386:
"_SSLCopyPeerCertificates", referenced from:
_darwinssl_connect_common in libcurl.all.a(libcurl_la-curl_darwinssl.o)
"_SSLDisposeContext", referenced from:
_Curl_darwinssl_close in libcurl.all.a(libcurl_la-curl_darwinssl.o)
_Curl_darwinssl_shutdown in libcurl.all.a(libcurl_la-curl_darwinssl.o)
_darwinssl_connect_common in libcurl.all.a(libcurl_la-curl_darwinssl.o)
"_SSLNewContext", referenced from:
_darwinssl_connect_common in libcurl.all.a(libcurl_la-curl_darwinssl.o)
"_SSLSetEnableCertVerify", referenced from:
_darwinssl_connect_common in libcurl.all.a(libcurl_la-curl_darwinssl.o)
"_SSLSetProtocolVersionEnabled", referenced from:
_darwinssl_connect_common in libcurl.all.a(libcurl_la-curl_darwinssl.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
SecurityFramework is already there in the project, and i have set Build Active Architecture Only to No. And since it compiles in Xcode 4.6.3, I don't think it got anything to do with missing target membership.
Is there any way to resolve this? Or a possible workaround, Its very essential to have this library working with Xcode5, since it needs to be used in an iOS7 application.
So, am posting the answer so that it could be useful for anyone who might face a similar situation. I was able to sort out the issue from the comments of #deltheli and #sergio, so many thanks to them for helping out.
So, I had to run
lipo -info
to know the supported architectures, and
found that armv7s and arm64 was not supported, so i tried compiling it in armv7, which failed and explains the problem why it works perfectly in Xcode 4.6 and not in 5. My libcurl was outdated! And the version I used didn't support some of the DarwinSSL symbols. Using a recent enough version fixed the issue for me.

Resources