Can't find headers for GoogleAnalytics-iOS-SDK with Cocoapods 0.37, Swift, frameworks

早过忘川 提交于 2019-12-03 01:41:54

This is a bug in Cocoapods 0.37.0. It has been logged in their tracker as issue #3499.

Workaround

  • Add $(SRCROOT)/Pods/GoogleAnalytics-iOS-SDK to the User Header Search Paths (set to Recursive) in the app target's Build Settings.
  • Reference the Google Analytics header directly in the Bridging Header with #import "GAI.h"

Another trick is to add long relative path(s) to the bridging header.

This avoids having to make changes to project settings which may be overridden next time you run `pod install':

#import "../../Pods/GoogleAnalytics/Headers/Public/GAI.h"
#import "../../Pods/GoogleAnalytics/Headers/Public/GAIFields.h"
#import "../../Pods/GoogleAnalytics/Headers/Public/GAIDictionaryBuilder.h"

It also works when running your unit tests too, which another solution I tried didn't.

I don't know if this is the correct answer or not, but the way we got it to work was to manually import libGoogleAnalyticsServices.a and not via cocoapods.

Locate libGoogleAnalyticsServices.a and drag it into the project, then add it to Linked Frameworks and Libraries (if it's not there already) and you're good to go. Don't forget to remove it from your Podfile.

edit:
Don't forget to add the header files to your bridging-header

Jan F.

I had a similar problem on CocoaPods 0.39.0.

$(inherited) in build setting 'OTHER_LDFLAGS' solved it.

https://stackoverflow.com/a/32004207/3129306

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!