Addev
Addev

Reputation: 32253

"Google/Analytics.h file not found" after updating pod to GoogleAnalytics

I was using the pod s

pod 'Google/Analytics'
pod 'Google/SignIn'

but after running pod install I was receiving the following warning at the end of the pod installation

[!] Google has been deprecated

I searched in Google and I found that it is suggested to use the new pods

pod 'GoogleAnalytics'
pod 'GoogleSignIn'

That removes the pod install warning. But makes my build fail with the following error in any file with the line:

#import <Google/Analytics.h>                    (!error)Google/Analytics.h file not found

How can I solve this?

Upvotes: 4

Views: 4613

Answers (2)

Benjamin Jimenez
Benjamin Jimenez

Reputation: 984

The GoogleAnalytics pod changed a few things as how the Google/Analytics pod worked. the Most important change is that GoogleAnalytics does not use the GoogleServices-Info.plist instead you should set up the tracker manually. Also the Google/Analytics.h file no longer exist, you must import the correct file, I leave you some examples.

#import <GoogleAnalytics/GAI.h>
#import <GoogleAnalytics/GAIFields.h>
#import <GoogleAnalytics/GAILogger.h>
#import <GoogleAnalytics/GAIDictionaryBuilder.h>
#import <GoogleAnalytics/GAITrackedViewController.h>
#import <GoogleAnalytics/GAITracker.h>

For more information check the dev guide https://developers.google.com/analytics/devguides/collection/ios/v3/?ver=swift

Upvotes: 11

Pavlo Boiko
Pavlo Boiko

Reputation: 583

Try delete this files (it will not break your project):

Pods 
*.xcworkspace
podfile.lock

and run pod install

If it does not help you please share your podfile.

Upvotes: 3

Related Questions