Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.)

like image 681
rihe Avatar asked Aug 23 '15 23:08

rihe


People also ask

How do I add Google Analytics to Swift?

simple bridging header file. Just add #import <Google/Analytics. h> in bridging header file. add import Google in every file you want to implement google analytics.


2 Answers

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.

like image 157
AntonyG Avatar answered Oct 05 '22 04:10

AntonyG


Following the tutorial posted by AntonyG won't do the trick unless you also add the following to your application target's linked libraries, as required by Google here:

  • CoreData.framework
  • SystemConfiguration.framework
  • libz.dylib
  • libsqlite3.dylib
like image 20
pommefrite Avatar answered Oct 05 '22 03:10

pommefrite