Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Google Analytics to an iOS app causes error

I've added GAI framework.

Files :

- GAI.h - GAIDictionaryBuilder.h - GAIFields.h GAILogger.h - GAITrackedViewController.h - GAITracker.h - libGoogleAnalytics_debug.a

But when I'm trying to build the project, it shows such error:

Undefined symbols for architecture i386:
  "_llvm_gcda_emit_arcs", referenced from:
      ___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAI.o)
      ___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIUncaughtExceptionHandler.o)
      ___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIBatchingDispatcher.o)
      ___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIDataStore.o)
      ___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIDefaultLogger.o)
      ___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIStringUtil.o)
      ___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAITrackerImpl.o)
      ...

"_llvm_gcda_emit_function", referenced from:
      ___llvm_gcov_writeout in ...

"_llvm_gcda_end_file", referenced from:
      ___llvm_gcov_writeout in ...

"_llvm_gcda_increment_indirect_counter", referenced from:
      -[GAI defaultTracker] in libGoogleAnalytics_debug.a(GAI.o)
      -[GAI setDefaultTracker:] in libGoogleAnalytics_debug.a(GAI.o)
      ...

"_llvm_gcda_start_file", referenced from:
      ___llvm_gcov_writeout in ...

ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

What caused this error?

Update :

// AppDelegate.h

@property (nonatomic, retain) id<GAITracker> tracker;

// AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{


[GAI sharedInstance].optOut = YES;
[GAI sharedInstance].dispatchInterval = 120;
[GAI sharedInstance].trackUncaughtExceptions = YES;
self.tracker = [[GAI sharedInstance] trackerWithName: kTrackerName
                                          trackingId: kTrackingId];

//other code 

return YES;
}
like image 345
Nikita Shytyk Avatar asked Sep 11 '13 16:09

Nikita Shytyk


People also ask

Does Google Analytics work on iOS?

Stay organized with collections Save and categorize content based on your preferences. Use our iOS sample app to see how Analytics works, or add Analytics to your existing app.


2 Answers

I Had the same error : Just add "libGoogleAnalyticsServices.a" into your files like this :

libGoogleAnalyticsServicesXcode5

I hope this can help you. It's work for me ;)

++

like image 93
Kevin Machado Avatar answered Nov 05 '22 11:11

Kevin Machado


In addition to all the libraries and frameworks specified in the README file, turns out that you need to include the AdSupport.framework and libGoogleAnalyticsServices.a (instead of the libGoogleAnalytics_debug.a) to get rid of the build errors while compiling for simulator.

like image 40
rajagp Avatar answered Nov 05 '22 11:11

rajagp