Reputation: 35
I've been trying to integrate google analytics for 5 days now with a phonegap app but with no luck, lastly I found a solution on stackoverflow which is adding this code to my mainviewcontrolar.m
- (void)viewWillAppear:(BOOL)animated {
// View defaults to full size. If you want to customize the view's size, or its subviews (e.g. webView),
// you can do so here.
// Initialize tracker.
[super viewWillAppear:animated];
// returns the same tracker you created in your app delegate
// defaultTracker originally declared in AppDelegate.m
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
// manual screen tracking
[tracker sendView:@"Home Screen"];
}
but this did not work, everytime I try it i get errors
Undefined symbols for architecture i386: "_OBJC_CLASS_$_GAI", referenced from: objc-class-ref in MainViewController.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)
please tell me what to do, Thanks
Upvotes: 0
Views: 2925
Reputation: 19800
In the newer version of Google Analytics, you'll need to add libGoogleAnalyticsServices.a
, not libGoogleAnalytics.a
as bogdanh mentioned.
Upvotes: 0
Reputation: 66
On your project "Targets", at "Build Phases", you need to add libGoogleAnalytics.a in "Link Binary With Libraries"
Upvotes: 3