Linker errors when trying to install new Google Analytics 3.0 Beta

IosGoogle AnalyticsGoogle Analytics-Api

Ios Problem Overview


I believe just today Google released a new update to their iOS Analytics frame work (version 3.0). When I follow the instructions and try to run the code, I get:

> Undefined symbols for architecture armv7: "_inflate", referenced > from: > l002 in libGoogleAnalyticsServices.a(NSData+zlib.o) "_deflate", referenced from: > l001 in libGoogleAnalyticsServices.a(NSData+zlib.o) "inflateInit2", referenced from: > l002 in libGoogleAnalyticsServices.a(NSData+zlib.o) "_deflateEnd", referenced from: > l001 in libGoogleAnalyticsServices.a(NSData+zlib.o) "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)
> "_inflateEnd", referenced from: > l002 in libGoogleAnalyticsServices.a(NSData+zlib.o) "_SCNetworkReachabilityCreateWithName", referenced from: > l027 in libGoogleAnalyticsServices.a(GAIReachabilityChecker.o) > l002 in libGoogleAnalyticsServices.a(TAGNetReachability.o) "_SCNetworkReachabilitySetCallback", referenced from: > l027 in libGoogleAnalyticsServices.a(GAIReachabilityChecker.o) > l002 in libGoogleAnalyticsServices.a(TAGNetReachability.o) > l003 in libGoogleAnalyticsServices.a(TAGNetReachability.o) "deflateInit2", referenced from: > l001 in libGoogleAnalyticsServices.a(NSData+zlib.o) "_SCNetworkReachabilityScheduleWithRunLoop", referenced from: > l027 in libGoogleAnalyticsServices.a(GAIReachabilityChecker.o) > l002 in libGoogleAnalyticsServices.a(TAGNetReachability.o) "_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from: > l027 in libGoogleAnalyticsServices.a(GAIReachabilityChecker.o) > l003 in libGoogleAnalyticsServices.a(TAGNetReachability.o) ld: symbol(s) not found for architecture armv7 clang: error: linker > command failed with exit code 1 (use -v to see invocation)

Possible they forgot to include a lib I need to add? (some other aspects of the instructions they forgot to change as well). Otherwise have followed their instructions to a tee and still not getting the needed results.

Ios Solutions


Solution 1 - Ios

I had to add both libz.dylib and AdSupport.framework to the build phases to make this go away. Google doesn't include these in their instructions so going to check with them to make sure this is OK then will update this post.

UPDATE: Now you also need to add libsqlite3.0.dylib to get it to work.

Solution 2 - Ios

I downloaded version 3.06 of the Google Analytics Services for iOS in early April 2014, and STILL ran into the problems referenced above. Google has updated their docs to mention the need to link the libz.dylib and the AdSupport.framework.

SOLUTION: I found through trial and error, I also needed to link the libsqlite3.dylib in order to build on the simulator or to a device.

Solution 3 - Ios

Add

libz.dylib

AdSupport.framework

libsqlite3.0.dylib

Google did not update their guide as of 8 Oct 2013.

Google Analytics Guide is here

Solution 4 - Ios

None of the above solutions worked for me. What did work for me, however, was adding these:

libz.dylib

libsqlite3.0.dylib

libGoogleAnalyticsServices.a

The libGoogleAnalyticsServices.a is a file that can be found in the download for Google Analytics for Mobile Apps iOS SDK v3.

Hope this helps!

Solution 5 - Ios

I had libz.dylib and AdSupport.framework as per instruction from Google, it worked fine.

Then I had to add -all_load in other linker flags for some other library dependency, then google analytics started failing build with linker error.

I had to add libsqlite3.0.dylib framework to get it to work.

So there is something to do with -all_load linker flag

Solution 6 - Ios

Till third party developers do not enable BITCODE for their old libraries, you can disable bit code in your own project if you are not going to have a Apple Watch extension for you application.

enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSer PounceView Question on Stackoverflow
Solution 1 - IosSer PounceView Answer on Stackoverflow
Solution 2 - IosDarrenView Answer on Stackoverflow
Solution 3 - IosNityaView Answer on Stackoverflow
Solution 4 - IosJoseph GillView Answer on Stackoverflow
Solution 5 - IoskrisrakView Answer on Stackoverflow
Solution 6 - IosSauvik DoluiView Answer on Stackoverflow