Including Google Analytics in the Swift Bridging Header

It really drove me crazy.

I followed the instructions on the Google Developer website (there is actually no import line, but if you check the item, you may notice that someone has mixed up and it should be #import <Google/Analytics.h> )

But Xcode just refuses to find Google Analytics, while it imports the other header in my header header is fine in order (for example, it reads the file fine, but only does one of the imports).

My file is as follows:

 #import <workinglibrary.h> #import <Google/Analytics.h> // this doesn't work! 

I tried all variations of <Analytics.h> or "Google/Analytics.h" and so on. My header search paths look great too:

 "${PODS_ROOT}/Headers/Public/Google" "${PODS_ROOT}/Headers/Public/Google/Google" "${PODS_ROOT}/Headers/Public/GoogleAnalytics" ... 

A final caveat: I'm not sure (since Xcode doesn't fully build when I do this), but I think Xcode imports the Analytics.h file correctly if I comment on the #import <workinglibrary.h> (at least I can use Apple + Click analytics features in other files to advertise them).

EDIT: just kidding that the last bit is not true

+6
source share
2 answers

I had the same problem. This was fixed in cocoapods 0.38.2

To update usage: gem install cocoapods

You can use_frameworks!

+1
source

It seems that for the latest stable Swift / Xcode / Cocoapods / GA it needs to put #import <GoogleAnalytics/GAI.h> in the title #import <GoogleAnalytics/GAI.h>

+1
source

Source: https://habr.com/ru/post/989964/


All Articles