[英]Archiving fails due to undefined Symbols for Google Analytics
I have integrated GAI using the most recent cocoapods version. 我使用最新的cocoapods版本集成了GAI。
When I build in the Debug config everything runs just fine. 当我构建Debug配置时,一切运行都很好。 However, as soon as I try to archive the Application the compiler fails with the following messages: 但是,只要我尝试归档应用程序,编译器就会失败,并显示以下消息:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_GAIDictionaryBuilder", referenced from:
objc-class-ref in libWLCore.a(WLTrackingHelper.o)
"_OBJC_CLASS_$_GAI", referenced from:
objc-class-ref in libWLCore.a(WLTrackingHelper.o)
"_kGAIScreenName", referenced from:
+[WLTrackingHelper trackView:] in libWLCore.a(WLTrackingHelper.o)
+[WLTrackingHelper resetView] in libWLCore.a(WLTrackingHelper.o)
"_kGAIAnonymizeIp", referenced from:
+[WLTrackingHelper prepareDefaultTracker:withAnonymization:withUnCaughtExceptions:withDebug:] in libWLCore.a(WLTrackingHelper.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Since it works in Debug I tried to figure out where the difference in the configuration between Debug and Release lies. 由于它在Debug中工作,我试图弄清楚Debug和Release之间的配置差异在哪里。 I found out that the Other linker flags in Release are empty whereas in Debug contains the flag for GoogleAnalytics and other frameworks and libraries. 我发现Release中的Other链接器标志是空的,而Debug中包含GoogleAnalytics和其他框架和库的标志。
After adding the flags to the Release Configuration of Other linker flags I got 将标志添加到我获得的其他链接器标志的释放配置之后
library not found for -lGoogleAnalyticsServices
After that, I added libPods and after that libPods-GoogleAnalytics to the Link Binary With Libraries section but the errors remained the same. 之后,我添加了libPods,然后将libPods-GoogleAnalytics添加到Link Binary With Libraries部分,但错误保持不变。
I invested almost 2 days into that problem, but I could not find any solution. 我在这个问题上投入了差不多2天,但我找不到任何解决方案。
After some fiddling I found the solution by adding not the library generated by cocoa pods (libPods-GoogleAnalytics), but directly linking the libGoogleAnalyticsServices to my main project. 经过一些小小的尝试后,我找到了解决方案,不是添加cocoa pods生成的库(libPods-GoogleAnalytics),而是直接将libGoogleAnalyticsServices链接到我的主项目。 Still, I think this is not the most elegant solution possible since the linker should know that the symbols he was missing were available already, as provided by cocoapods. 尽管如此,我认为这不是最优雅的解决方案,因为链接器应该知道他丢失的符号已经可用,如cocoapods所提供的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.