Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
350 views
in Technique[技术] by (71.8m points)

ios - Duplicate interface definition for class 'GTMHTTPUploadFetcher'

I plan to use Google Drive API in my Swift project. I'm trying to add the Drive SDK via CocoaPods (v0.39.0). Below is my Podfile.

platform :ios, '8.0'
use_frameworks!

pod 'Google-API-Client/Drive'

I have the use_frameworks! flag added so that CocoaPods can convert Objective-C pods to Swift frameworks instead of static libraries.

Pod installation is successful. However when I build the project, I get the following error.

Duplicate interface definition for class 'GTMHTTPUploadFetcher'

Deleting DerivedData folder and cleaning the project didn't work.

I also tried without adding the use_frameworks! and then adding the library via a bridging header way. That works without an issue. The thing is all my other dependencies work with it turned on. And unfortunately CocoaPods doesn't support turning that flag for certain pods only.

Is there a workaround to resolve this issue?


As stated in Google's docs, Google engineers supposedly monitor questions tagged with google-drive-sdk so I hope at least they'll see this and fix it soon.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

According to Google this error is caused by using a cocoapod by a third party, but they now have an official pod in the project (https://github.com/google/google-api-objectivec-client/blob/master/GoogleAPIClient.podspec) and the problem should be fixed.

See: https://github.com/google/google-api-objectivec-client/issues/103

Use:

pod 'GoogleAPIClient/Drive', '~> 1.0'

and probably also:

pod 'GTMOAuth2' or pod 'Google/SignIn'


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...