ios Xcode 7 构建失败,因为 ld:找不到 -lGoogleAnalyticsServices 的库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32721690/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 07:46:51  来源:igfitidea点击:

Xcode 7 build failed due to ld: library not found for -lGoogleAnalyticsServices

iosxcodexcode7

提问by Aashay

I have been struggling to get my xcode project to build for the last couple hours. I keep getting the following error:

在过去的几个小时里,我一直在努力构建我的 xcode 项目。我不断收到以下错误:

ld: library not found for -lGoogleAnalyticsServices clang: error: linker command failed with exit code 1 (use -v to see invocation)

ld:找不到 -lGoogleAnalyticsServices 的库 clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

I have tried almost everything. I saw that the Google Developers website said to use pod 'Google/Analytics', even after trying almost everything I could find on StackOverflow and Google regarding the error, I have had absolutely no luck.

我几乎尝试了所有方法。我看到 Google Developers 网站说要使用 pod 'Google/Analytics',即使在尝试了几乎所有我可以在 StackOverflow 和 Google 上找到的关于错误的内容之后,我也绝对没有运气。

I upgraded to XCode 7 yesterday, everything seemed to work yesterday but today suddenly I started getting this error.

我昨天升级到 XCode 7,昨天似乎一切正常,但今天突然我开始收到这个错误。

If someone has anything I can do about this error, please help!

如果有人对这个错误有什么我可以做的,请帮忙!

Pointing me in the right direction to get it fixed would be awesome too!

将我指向正确的方向以修复它也很棒!

Thanks in advance for your help.

在此先感谢您的帮助。

回答by Raptor

The linker flag has been renamed to:

链接器标志已重命名为:

-lGoogleAnalytics

but the Cocoapods settings have not been updated yet. Rename the entry in "Other Linker Flags" and your problem will be solved.

但是 Cocoapods 设置还没有更新。重命名“其他链接器标志”中的条目,您的问题将得到解决。

Also, the library (as of the moment I write is version 3.13.0) does not support Bitcode yet, thus please turn off Bitcode in Build Options > Enable Bitcode > Select "No". Clean & Rebuild afterwards.

此外,该库(截至我编写的版本是 3.13.0)尚不支持 Bitcode,因此请在 Build Options > Enable Bitcode > 选择“No”中关闭 Bitcode。清洁和重建之后。

回答by Dhanas Manian

  1. Please make sure you opened .xcworkspace not .xcodeproj.

  2. Go to Library Search Paths in Build settings and add

    1. $(PROJECT_DIR)/Pods/build/Debug-iphoneos
    2. $(inherited)
  3. pod install again.

    Update cocoapods to the newest version that supports 64 arch.

    sudo gem update cocoapods

    Delete all Valid Architectures and Re-Add the architectures that you just removed.

    Clean and run

  1. 请确保您打开的是 .xcworkspace 而不是 .xcodeproj。

  2. 转到构建设置中的库搜索路径并添加

    1. $(PROJECT_DIR)/Pods/build/Debug-iphoneos
    2. $(继承)
  3. 再次安装 pod。

    将 cocoapods 更新到支持 64 arch 的最新版本。

    sudo gem 更新 cocoapods

    删除所有有效架构并重新添加刚刚删除的架构。

    清洁并运行

回答by Dharmesh Siddhpura

Same problem occurred in my project. What I did, I just updated all my pods and after that my app got compiled.

我的项目中也出现了同样的问题。我所做的,我只是更新了我所有的 pod,然后我的应用程序就被编译了。

Run "pod update" command from terminal in your project directory where the pod file is located.

从终端在 pod 文件所在的项目目录中运行“pod update”命令。

回答by Hyman B

Without looking directly at your build settings, there's a number of things that could be causing this. The main issue is in your linker flags you likely have something lingering/incorrect. Most of your pods have the prefix of:

如果不直接查看您的构建设置,有很多原因可能会导致这种情况。主要问题是在您的链接器标志中,您可能有一些挥之不去/不正确的东西。您的大多数 Pod 都具有以下前缀:

-lPods-WhichIt-SomePodsLib

However your GoogleAnalyticsLibrary has the prefix:

但是,您的 GoogleAnalyticsLibrary 具有前缀:

-lGoogleAnalyticsServices

This might indicate a lingering flag from your. Try looking for this entry in Other Linker Flags (Under Build Settings) and clear this out and re-running pod install.

这可能表明您的标志挥之不去。尝试在其他链接器标志(在构建设置下)中查找此条目并清除它并重新运行 pod install。

Other things to check:

其他检查事项:

  • Cocoapods version is latest stable version
  • You are using the latest version of Google's official Analytics pod
  • Your library/framework search paths (build settings) are correctly pointing to the analytics library in question.
  • Cocoapods 版本是最新的稳定版本
  • 您正在使用最新版本的 Google 官方Analytics pod
  • 您的库/框架搜索路径(构建设置)正确指向相关分析库。

For the record, I've had issues with pods and using google libs before they officially started releasing in cocoapods. If all else fails, remove the pod entry from your Podfile and try adding the library manually.

作为记录,在正式开始在 cocoapods 中发布之前,我遇到了 pod 和使用 google libs 的问题。如果所有其他方法都失败了,请从 Podfile 中删除 pod 条目并尝试手动添加库。