Cocoapods 重复符号 - Google API

Cocoapods duplicate symbol - Google APIs

两天前我已经执行了pod update,一切顺利,我可以构建项目。日志:

Removing DTAlertView
Downloading dependencies
Using GTMHTTPFetcher (0.1.0)
Using Google-API-Client (0.1.1)
Using Google-Maps-iOS-SDK (1.9.0)
Using KissXML (5.0)
Using MGSwipeTableCell (1.3.3)
Installing RNBlurModalView (0.1.0)
Using gtm-oauth2 (0.1.0)
Using iVersion (1.11.4)
Using libextobjc (0.4.1)
Generating Pods project
Integrating client project

现在我不得不再次执行 pod update,但是现在我无法构建项目。日志:

Removing RNBlurModalView
Downloading dependencies
Installing GTMHTTPFetcher 1.141 (was 0.1.0)
Using Google-API-Client (0.1.1)
Installing Google-Maps-iOS-SDK 1.9.1 (was 1.9.0)
Using KissXML (5.0)
Installing MGSwipeTableCell 1.3.5 (was 1.3.3)
Installing gtm-http-fetcher (1.0.141)
Installing gtm-oauth2 1.0.125 (was 0.1.0)
Using iVersion (1.11.4)
Using libextobjc (0.4.1)
Generating Pods project
Integrating client project

[!] GTMHTTPFetcher has been deprecated in favor of gtm-http-fetcher

我今天需要完成一项功能,但我的项目没有生成。至少要让它能够构建,该怎么做? pod install 没有帮助。我注意到 Google-Maps-iOS-SDK 的版本跳转可能使 GTMHTTPFetcher 变得一团糟,所以我尝试在 podfile 版本 1.9.0 中设置:

inhibit_all_warnings!

pod 'libextobjc', '~> 0.4'
pod 'KissXML', '~> 5.0'
pod 'Google-Maps-iOS-SDK', '1.9.0'
pod 'Google-API-Client', '~> 0.1'
pod 'MGSwipeTableCell', '~> 1.0'
pod 'iVersion', '~> 1.10'

但这并没有帮助。可能 Google-api-client 与 Google 地图不兼容,因为如果我删除 google api:

Removing GTMHTTPFetcher
Removing Google-API-Client
Removing gtm-http-fetcher
Removing gtm-oauth2
Downloading dependencies
Installing Google-Maps-iOS-SDK (1.9.1)
Using KissXML (5.0)
Using MGSwipeTableCell (1.3.5)
Using iVersion (1.11.4)
Using libextobjc (0.4.1)
Generating Pods project
Integrating client project

而且它可能会起作用(无法尝试,代码中的许多连接)。错误:

[... many more of same type as below ...]
duplicate symbol _OBJC_METACLASS_$_GTMReadMonitorInputStream in:
    /Users/username/Library/Developer/Xcode/DerivedData/project-cvbrvhbcpumxaohhjabqvxiyzotr/Build/Products/Debug-iphoneos/libPods-GTMHTTPFetcher.a(GTMReadMonitorInputStream.o)
    /Users/username/Library/Developer/Xcode/DerivedData/project-cvbrvhbcpumxaohhjabqvxiyzotr/Build/Products/Debug-iphoneos/libPods-gtm-http-fetcher.a(GTMReadMonitorInputStream.o)
ld: 163 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

清理或删除派生数据都无济于事。

这两个好像也不是一回事吧?

Installing gtm-http-fetcher (1.0.141)
Installing GTMHTTPFetcher 1.141 (was 0.1.0)

并且由于错误是链接器中的重复符号,我会尝试删除其中一个符号。

我遇到过这个案例,已经解决了。 打开 Pod 的两个配置文件
Pods-your_app_name.debug.xcconfig
Pods-your_app_name.release.xcconfig
然后删除与 "GTMHTTPFetcher" 相关的所有内容。清理并重新构建。它会工作正常。
到目前为止,此解决方案不是最佳解决方案。因为每次你 运行 命令 "pod install",GTMHTTPFetcher 都会自动安装,你(包括我)必须按照上面的步骤再次删除。无论如何,到目前为止,这对我来说是独一无二的解决方案。

我post将此作为更新的答案。

来自@peter-segerblom 的 post,我注意到实际上 GTMHTTPFetchergtm-http-fetcher 的旧版本。由于兼容性问题,我无法更新 Google-API-Client。临时解决方法是:

  1. 打开~/.cocoapods/repos
  2. 删除 gtm-oauth2 (>= 1.0.125)
  3. 删除gtm-http-fetcher(全部)
  4. 删除 GTMHTTPFetcher (> 0.1.0)

但是 atm,我们所有人都需要更新库才能使用 bitcode,因为该项目甚至不会在新的 Xcode 中构建。因此,我更新了我的代码并更改了版本:

pod 'Google-API-Client', '~> 0.1'

至:

pod 'Google-API-Client', '~> 1.0'

现在只需等待 Google 将库更新为位码要求,就像新的 Google-API-Client 一样,一切正常,我们不需要通过从 [=20 中删除来进行这些修改=].