Reputation: 6490
I need to add google analytics to my iOS App,
I have implemented this 3 steps.
Step 1: Downloaded google analytics Library file and added this files to project,
libGoogleAnalyticsServices.a
CoreData.framework
Step 2: Added this code in didFinishLaunchingWithOptions
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GAI sharedInstance].trackUncaughtExceptions = YES;
[GAI sharedInstance].dispatchInterval = 20;
[[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose];
[[GAI sharedInstance] trackerWithTrackingId:@"UA-XXXX-Y"];
}
Step 3: For example, suppose you have a “Home Screen” view that you want to measure with a view controller header that looks like this:
@interface HomeViewController : UIViewController
I have updated this header to:
#import "GAITrackedViewController.h"
@interface HomeViewController : GAITrackedViewController
after doing this i am getting Error like,
duplicate symbol _OBJC_CLASS_$_GAIUtil in:
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalytics_debug.a(GAIUtil.o)
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalyticsServices.a(GAIUtil.o)
duplicate symbol _OBJC_METACLASS_$_GAIUtil in:
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalytics_debug.a(GAIUtil.o)
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalyticsServices.a(GAIUtil.o)
duplicate symbol _OBJC_CLASS_$_GAIDefaultLogger in:
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalytics_debug.a(GAIDefaultLogger.o)
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalyticsServices.a(GAIDefaultLogger.o)
duplicate symbol _OBJC_IVAR_$_GAIDefaultLogger._logLevel in:
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalytics_debug.a(GAIDefaultLogger.o)
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalyticsServices.a(GAIDefaultLogger.o)
duplicate symbol _OBJC_METACLASS_$_GAIDefaultLogger in:
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalytics_debug.a(GAIDefaultLogger.o)
/Users/Supriya/Desktop/BTS 2.0/BTS/BTS/Library/libGoogleAnalyticsServices.a(GAIDefaultLogger.o)
EDIT:
I have added this frameworks and Library in my projects which i told you above.
:
Where i am doing mistake ? please help
Thanks in advance.
Upvotes: 2
Views: 1358
Reputation: 16204
You have to delete one of these two libGoogleAnalytics_debug.a, libGoogleAnalyticsServices.a
from your project. Find out, where they are and how they are generated and make so, that only one of these libraries is involved in your build. I suppose, one of them is added by you and the other is automatically created and added, when you build.
Upvotes: 4
Reputation: 11037
Error is coming due to duplicate symbols and looking your logs seems that you have added your Google Analytics SDK twice.
check the linking of files in the left side pane and remove them if your found them twice.
Upvotes: 0