Search code examples
iosobjective-cgoogle-analyticsgoogle-analytics-sdk

Can't add Google Analytics iOS SDK without cocoa pods to my project


I would like to add the Google Analytics iOS SDK to my project but unfortunately it doesn't work. I'm not using Cocoa Pods, maybe that's the problem because Google says use it in the tutorial, but I can't use it in this project because of other reasons.

So that's how I tried:

  • I created the configuration file
  • I've added the GoogleService-info.plist
  • I've added the GoogleAnalytics/Library folder to my project and the libGoogleAnalyticsServices.a file

Then I added this to my AppDelegate.m

 #import <Google/Analytics.h>
 //...

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

// Configure tracker from GoogleService-Info.plist.
    NSError *configureError;
    [[GGLContext sharedInstance] configureWithError:&configureError];
    NSAssert(!configureError, @"Error configuring Google services: %@", configureError);

   return YES;
}

It's exactly from the tutorial, but when I try to run it I get an error that Google/Analytics.h file not found. I would really appreciate if somebody could tell me what's the problem, or somebody could explain me how can I setup the whole thing without cocoa pods (which files should I add from the zip.)


Solution

  • I was looking for the exact same thing just now. I found this very simple tutorial, it worked for me. Let me know if you need more help on this.