Duplicate Interface Definition for Class 'Gtmhttpuploadfetcher'

Duplicate interface definition for class 'GTMHTTPUploadFetcher'

I ran into this same problem. My solution was to not install the Google API Client for iOS using CocoaPods because I was using Swift-based pods and I, therefore, could not remove use_frameworks! to attempt to get around the duplicate header issue.

I instead installed the library manually by following the detailed instructions at https://developers.google.com/drive/ios/quickstart?ver=swift for Steps 2, 3, and 4. I followed the instructions but applied them to my existing workspace instead of creating a new workspace.

It's important to note that I had to adjust the paths in User Header Search Paths to match the locations where I actually copied the source code from Google.

I'm copying the instructions here for reference.

Step 2: Download the Google Client Library

Run the following commands to download the library using git:

  • git clone https://github.com/google/google-api-objectivec-client.git
  • git clone https://github.com/google/gtm-oauth2.git
  • git clone https://github.com/google/gtm-session-fetcher.git
  • git clone https://github.com/stig/json-framework.git -b v2.3
  • cp -R gtm-oauth2/Source google-api-objectivec-client/Source/OAuth2
  • cp -R json-framework/Classes google-api-objectivec-client/Source/JSON

Step 3: Prepare the workspace

Open Xcode and create a new workspace named "Quickstart".
Using File > Add Files to "Quickstart"..., add the following projects to the workspace from the libraries you cloned in the previous step:

  • google-api-objectivec-client/Source/GTL.xcodeproj
  • gtm-session-fetcher/Source/GTMSessionFetcher.xcodeproj

Select the "GTMSessionFetcher" project and make the following changes:

  • Add a new target of the type iOS > Framework & Library> Cocoa Touch Static Library and name it "GTMSessionFetcherLib".
  • Add all of the .m files in the project's GTMSessionFetcher group to the target's Build Phases > Compile Sources section.

Select the "GTL" project's "GTLTouchStaticLib" target and make the following changes:

  • Add the library GTMSessionFetcher/libGTMSessionFetcherLib.a to Build Phases > Link Binary with Libraries.
  • Add the absolute path to gtm-session-fetcher/Source/ to Build Settings > User Header Search Paths.
  • Add the flag GTM_USE_SESSION_FETCHER=1 to Build Settings > Preprocessor Macros.
  • Delete the "GTL" project's "GTLFramework" target.
  • In the Project navigator, delete GTL project's GTL Source > Common > HTTPFetcher group.

Step 4: Prepare the project

  • Create a new iOS > Application > Single View Application project named "QuickstartApp". Set the Language to Swift , and when saving the project set the Add to and Group fields to "Quickstart".
  • Add the following frameworks and libraries to the project's Build Phases > Link Binary with Libraries section:
    libGTLTouchStaticLib.a

    • Security.framework
    • SystemConfiguration.framework
  • Change the following Build Settings:
  • Add -ObjC -all_load to Other Linker Flags.
  • Add the absolute path to the following directories to User Header Search Paths:

    • gtm-session-fetcher/Source/
    • google-api-objectivec-client/Source/**
  • Add the flag GTM_USE_SESSION_FETCHER=1 to Preprocessor Macros.
  • Add the file google-api-objectivec-client/Source/OAuth2/Touch/GTMOAuth2ViewTouch.xib to the project's Supporting Files group.
  • Add the following files to the QuickstartApp group:

    • google-api-objectivec-client/Source/Services/Drive/Generated/GTLDrive_Sources.m
    • google-api-objectivec-client/Source/Services/Drive/Generated/GTLDrive.h
  • If not created automatically, create a new header file Bridging-Header.h with the following content:

    • #import "GTMOAuth2ViewControllerTouch.h"
    • #import "GTLDrive.h"
  • Set Build Settings > Objective-C Bridging Header to the absolute path of the bridging header.

Google API Client GTMHTTPUploadFetcher duplicated

It's working already, just need to bump the version to Google-API-Client (1.0.422)

Cocoapods: duplicate interface definition

Have you tried updating to the latest release of CocoaPods? I noticed you mentioned you're using an outdated release candidate, which is possibly at fault here.

In general, here's what you need to do when creating and using a CocoaPod in your app:

1) In your CocoaPod, declare all of your dependencies in the pod spec, using s.dependency for each

2) In your app, use CocoaPods to manage all of of your app dependencies. That is, don't manually drag-and-drop libraries into your app. If you do, you risk creating duplicate classes with the ones that you drag-and-drop include.

3) In both your app and CocoaPod, depend on as flexible versions as you can. In general, you should at least allow for minor version updates, e.g. pod 'PodName', '~> 1.0.0'.

4) In your app's pod file, specify a target for your app and your unit test target, e.g.

target "MyApp" do
# App pods...
end

target "MyAppTests", :exclusive => true do
# Test pods...
end

If you have more than two targets, specify a target for each. Or, at the very least, specify a different target for unit tests, which will get the app injected into it.

iOS: Duplicate interface definition for class 'EAGLView'

You can refractor one of the class names. I think the would be the quickest, easiest way. Xcode has an option similar to ^click>refractor and choose name.
I also recommend saying yes, when Xcode asks you if you want to take a snapshot of the project first, just in case.



Related Topics



Leave a reply



Submit