简体   繁体   English

由于Google Analytics的未定义符号,存档失败

[英]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所提供的。

Please confirm you have added $(inherited) to Other Linker Flags (Build Settings) as in the below image. 请确认您已将$(继承)添加到其他链接器标志(构建设置),如下图所示。 Add the same in Release also, otherwise the same error will pop up at the time of archiving. 在Release中也添加相同的内容,否则在归档时会弹出相同的错误。 在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google Analytics(分析)和Xcode 7出现未定义符号错误 - Undefined symbols error with Google Analytics and Xcode 7 将Google Analytics(分析)更新为3.0.1后,架构i386的Xcode 5未定义符号 - Xcode 5 Undefined symbols for architecture i386 After Updating Google Analytics to 3.0.1 体系结构i386的未定义符号:“ _ OBJC_CLASS _ $ _ Analytics” - Undefined symbols for architecture i386: “_OBJC_CLASS_$_Analytics” 存档时,应用程序会获得“体系结构armv7的未定义符号”,除非我没有在库中剥离链接的产品 - App gets “Undefined symbols for architecture armv7” when archiving, unless I don't Strip Linked Product in a library Xcode无法构建Google Analytics(分析)SDK - Xcode fails building Google Analytics SDK Xcode 构建失败,架构 arm64 的未定义符号: - Xcode build fails with Undefined symbols for architecture arm64: 链接器错误,导致Google Analytics(分析)游戏无法构建 - Game with Google Analytics failing to build due to linker errors 存档我的.xcworkspace文件失败 - Archiving my .xcworkspace file fails React Native Firebase 分析:架构 x86_64 的未定义符号 - React Native Firebase Analytics: Undefined symbols for architecture x86_64 Google Calendar API - 架构 i386 的未定义符号 - Google Calendar API - Undefined symbols for architecture i386
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM