Cocoapods重复符号 - Google API

时间:2015-01-23 07:57:41

标签: ios objective-c google-maps cocoapods google-api-client

我在2天前表现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 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)

无论是清理还是删除派生数据都无济于事。

3 个答案:

答案 0 :(得分:2)

我遇到了这个案子并且已经解决了。 打开Pod的两个配置文件 豆荚,your_app_name.debug.xcconfig
豆荚,your_app_name.release.xcconfig
然后删除与" GTMHTTPFetcher"相关的任何内容。清洁并再次建造。它会工作正常。
到目前为止,该解决方案不是最佳解决方因为每次运行命令" pod install"时,GTMHTTPFetcher都会自动安装,你(包括我)必须按照上面的步骤再次删除。无论如何,这是我迄今为止唯一的解决方案。

答案 1 :(得分:0)

这两个看起来也是一回事?

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

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

答案 2 :(得分:0)

我将此作为更新的答案发布。

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

  1. 打开~/.cocoapods/repos
  2. 删除gtm-oauth2(> = 1.0.125)
  3. 删除gtm-http-fetcher(整个)
  4. 删除GTMHTTPFetcher(> 0.1.0)
  5. 但是atm,我们所有人都需要更新库以使用bitcode,因为项目甚至不会在新的Xcode中构建。因此,我更新了我的代码并更改了版本:

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

    为:

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

    现在只等Google将lib更新为bitcode要求,就像新的Google-API-Client一样,一切正常,我们不需要从.cocoapods/repos删除这些黑客。