添加到AppDelegate时未找到Google / Analytics.h文件 [英] Google/Analytics.h file not found when adding to AppDelegate
问题描述
我正在尝试使用Cocoapods将Google Analytics集成到我的ios项目中。但是,在遵循这个的步骤之后,直到添加配置文件到我的项目中,当在AppDelegate中导入Google / Analytics.h时,我找不到文件错误。尝试以下事项:
-
添加了
$(SRCROOT)/ Pods / GoogleAnalytics
添加到生成设置中的用户头搜索路径。 添加
libGoogleAnalyticsServices.a
在其他链接标志中添加 -lGoogleAnalyticsServices
。 > 不需要做2和3,因为它们可以免费使用Cocoapods。
问题
- 官方文档上的代码示例建议
安装1.0.0。甚至没有为
arm64编译的二进制文件。 - 似乎至少有三个与
GA相关的独立窗格。 GoogleAnalytics-iOS-SDK,Google Analytics,Google / Analytics。 >将它添加到您的Podfile中:pod'Google / Analytics'
,然后pod install
。
这应该有效。现在您可以按照文档中的建议简单导入Google / Analytics.h:
#import< Google / Analytics.h>
进一步讨论
我碰到两组问题:
-
当使用不正确的建议pod版本(1.0.0)时,是一个64位兼容性问题。 (
ld:symbol(s)not found for architecture arm64
) -
当使用其他豆荚GoogleAnalytics-iOS-SDK和GoogleAnalytics)我抱怨缺少
< Google / Analytics.h>
头文件。 (Google / Analytics.hnot found
)
我在邮件列表中发现了这位绅士的帖子 Google / Analytics版本没有版本号。 (
pod'Google / Analytics'
,如上所述。)I am trying to integrate Google Analytics in my ios project using Cocoapods. However, after following this for the steps till adding configuration file to my project, when importing the Google/Analytics.h in AppDelegate I get error for file not found. Tried following things:
Added
$(SRCROOT)/Pods/GoogleAnalytics
to User Header Search Paths in Build Settings.Added
libGoogleAnalyticsServices.a
to link binary with libraries in build phases.Added
-lGoogleAnalyticsServices
in Other Linker Flags.
Don't really want to do 2 and 3 as they make it free from Cocoapods.
What exactly am I missing?
解决方案Problems
- The code examples on the official documentation suggest installing 1.0.0. Which doesn't even have binaries compiled for arm64.
- There seem to be at least three separate pods related to GA. GoogleAnalytics-iOS-SDK, GoogleAnalytics, Google/Analytics.
Solution
Add this to your Podfile:
pod 'Google/Analytics'
and thenpod install
.That should work. Now you can simply import Google/Analytics.h as suggested in the docs:
#import <Google/Analytics.h>
Further Discussion
There were two sets of issues that I ran into:
When using the incorrect suggested pod version (1.0.0), was a 64-bit compatibility issue. (
ld: symbol(s) not found for architecture arm64
)When using the other pods (GoogleAnalytics-iOS-SDK and GoogleAnalytics) I had complaints of a missing
<Google/Analytics.h>
header file. ("Google/Analytics.h" not found
)
I found this gentleman's post on a mailing list which suggested the Google/Analytics pod with no version number. (
pod 'Google/Analytics'
as noted above.)这篇关于添加到AppDelegate时未找到Google / Analytics.h文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
-