Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems adding Google Analytics to iOS App

When I run through implementing Google Analytics in my app, using this walk through: http://code.google.com/mobile/articles/analytics_end_to_end.html

After adding the libGoogleAnalytics.a CFNetwork and libsqlite3.0.dylib frameworks, and added the GANTracker.h into my AppDelegate.m

I get this error:

Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_GANTracker", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

and the app won't even compile. My app is aimed at iOS 5.0

I'm pretty stuck. Any advice or work throughs would be very highly appreciated.

like image 417
frddsgn Avatar asked Mar 23 '12 07:03

frddsgn


People also ask

Is Apple blocking Google Analytics?

Safari does not block Google Analytics by default With the “Privacy Report,” Apple added many new privacy features to help protect users from being tracked across the internet. In the presentation, Apple showed that Google Analytics was the most frequently blocked tracker.

Does iOS 14 block Google Analytics?

As more information has surfaced, it appears that Intelligent Tracking Prevention (ITP) in Safari 14 is not completely blocking Google Analytics. Instead, it's blocking third-party tracking cookies and cross-site scripting requests, which limits portions of Google Analytics.

Does Google Analytics work on iOS?

Use Tag Manager with Google Analytics and Firebase. To get the latest mobile app report features in Google Analytics, use Firebase in your Android and iOS apps. Once enabled in your app, Google Analytics will automatically collect and report on built-in events and user properties.


5 Answers

I was working on a Cordova based XCode project. And got stuck with these stupid errors before figuring out what the linking errors meant. So here is what you do..

First, make sure you follow the steps mentioned https://github.com/phonegap/phonegap-plugins/tree/master/iOS/GoogleAnalytics. Next make sure you have the following files under the project linked via Build Phases (You get that when you click on the project name.. figure it out)

  1. GANTracker.h
  2. libsqlite3.0.dylib
  3. libGoogleAnalytics.a
  4. CFNetwork.framework

Also make sure your Plugins folder has 2 files, GoogleAnalyticsPlugin.h and GoogleAnalyticsPlugin.m.

If that doesn't help resolve your bugs. Then God help you. Start praying. Or alternatively try a bug spray. See if that works.

like image 42
William Borges Avatar answered Oct 25 '22 06:10

William Borges


I actually figured out the answer after posting the comment.

Click on your project in the "Project Navigator", then click on your project under "Targets". You then need to click on "Build Phases". You need to make sure libsqlite3.0dylib and CFNetwork.framework are added to the "Link Binary WIth Libraries". I had this, but what I didnt have was you also need to add libGoogleAnalytics.a to that same area. That fixed the problem for me.

like image 145
Etch Avatar answered Oct 25 '22 05:10

Etch


In my case, I add the AdSupport.framework for the missing "_OBJC_CLASS_$_ASIdentifierManager"

like image 37
xzysun Avatar answered Oct 25 '22 05:10

xzysun


Just adding to the answer of @Etch.

Xcode 4.5 dropped armv6 and only supports armv7. Therefore, your lib might be an old version and you need to download version 1.5.1 onward. Download here

Issues: http://code.google.com/p/analytics-issues/issues/detail?id=232

like image 27
Lunf Avatar answered Oct 25 '22 05:10

Lunf


I had the same issue. The solution was move the library to same level of .h files. But I don't know why this work.

like image 1
Márcia Silva Avatar answered Oct 25 '22 06:10

Márcia Silva