This has actually been driving me crazy.
这真让我发疯。
I've been following the instructions on the Google Developer's site (which doesn't actually have an import line, but if you inspect the element you can kinda notice that someone messed up and it's supposed to be #import <Google/Analytics.h>
)
我一直在遵循谷歌开发人员站点上的说明(它实际上没有导入行,但是如果您检查元素,您会注意到有人搞砸了,它应该是#import <谷歌 analyticsh> )
But Xcode just refuses to find the Google Analytics, while it imports the other header in my bridging header perfectly alright (e.g. it reads the file fine, but only does one of the imports).
但是Xcode拒绝找到谷歌分析,而它在我的桥接头中导入了另一个头(例如,它很好地读取了文件,但只做了一个导入)。
My file looks like this:
我的文件是这样的:
#import <workinglibrary.h>
#import <Google/Analytics.h> // this doesn't work!
I've tried every variation of <Analytics.h>
or "Google/Analytics.h"
and so on. My header search paths looks fine too:
我尝试过 <分析> 的每一种变化。h >或“谷歌/分析。h”等等。我的头搜索路径看起来也不错:
"${PODS_ROOT}/Headers/Public/Google"
"${PODS_ROOT}/Headers/Public/Google/Google"
"${PODS_ROOT}/Headers/Public/GoogleAnalytics"
...
Final caveat: I'm not sure (since Xcode doesn't fully build when I do this), but I think that Xcode properly imports the Analytics.h
file if I comment out the #import <workinglibrary.h>
statement (at least, I can Apple + Click analytics functions in other files to get to their declaration).
最后的警告:我不确定(因为Xcode在我这样做时没有完全构建),但是我认为Xcode正确地导入了分析。h文件,如果我注释掉#import
EDIT: just kidding that last bit isn't true
编辑:开玩笑说最后一点不是真的
2 个解决方案
#1
1
I had same issue. This has been fixed in cocoapods 0.38.2
我有同样的问题。这在可可粉中被固定了0.38.2
To update use: gem install cocoapods
更新用途:宝石安装可可粉
You can use_frameworks!
你可以use_frameworks !
#2
1
Seems like for the latest stable Swift/XCode/Cocoapods/GA it needs putting #import <GoogleAnalytics/GAI.h>
into bridging header
似乎对于最新稳定的Swift/XCode/Cocoapods/GA来说,它需要加入#import
#1
1
I had same issue. This has been fixed in cocoapods 0.38.2
我有同样的问题。这在可可粉中被固定了0.38.2
To update use: gem install cocoapods
更新用途:宝石安装可可粉
You can use_frameworks!
你可以use_frameworks !
#2
1
Seems like for the latest stable Swift/XCode/Cocoapods/GA it needs putting #import <GoogleAnalytics/GAI.h>
into bridging header
似乎对于最新稳定的Swift/XCode/Cocoapods/GA来说,它需要加入#import