CocoaPods 1.0.1 Redefinition of 'XYZ', Red

2019-09-10 11:32发布

问题:

I am upgrading CocoaPods (0.39.0) to latest version (1.0.1) and moving some directly integrated frameworks (copied in the main project instead of using CocoaPods-spec). I am using XCode (7.2.1).

Following is the podfile that is used with CocoaPods 1.0.1:

platform :ios, '8.0'

target 'ABC-v2' do
    # use_framework is required for dynamic frameworks integration.
    use_frameworks!

    pod 'SSKeychain', '~>1'
    pod 'Mantle', '~>1'
    pod 'GoogleAPIClient/Drive', '~>1'
    pod 'GTMOAuth2', '~>1'
    pod 'GTMSessionFetcher'
    pod 'libextobjc/EXTScope', '~>0.4'
    pod 'Typhoon', '~>3'

    # swift framework test, would need this eventually.
    #pod 'Alamofire', '~>3'

    # PSPDFKit - 5.8.3
    pod 'PSPDFKit', podspec:'https://customers.pspdfkit.com/cocoapods/.../latest.podspec'

    #disabled it temporarily to separate out xcode build error. 
    #target :SSS do
    #    pod 'ABC-iOS-SDK', :path => 'submodules/abc-ios-sdk'
    #end

    #disabled it temporarily to separate out xcode build error. 
    #target :TW do
    #    pod 'ABC-iOS-SDK', :path => 'submodules/abc-ios-sdk'
    #end

    target :ABCTests do
        inherit! :search_paths
        pod 'OCMock', '~> 3'
        pod 'OCMockito', '~> 1'
        pod 'VCRURLConnection', '~> 0.2', :inhibit_warnings => true
    end
end

Now I am trying to resolve compile errors upon build, which are related to libraries getting included multiple times.

  • Referred to CocoaPods Migration Guide at http://blog.cocoapods.org/CocoaPods-1.0-Migration-Guide/
  • Tried recompiling after complete clean (cmd-alt-shift-k), removing pod files (rm -rf Pods/ podfile.lock) & deleting DerivedData.
  • Ensured that there is no duplicate *.a files in the Target->Build Phases->Link Binary with Libraries. Upon 'pod install', "Pods_ABC_v2.framework" is added there.
  • Deleted other targets, such as Widget and an extension & disabled them in podfile as well.
  • There is directly integrated evernote sdk (evernote-sdk-ios.xcodeproj), which has EVSSKeychain.h/.m files with modified definitions with EV prefix (EVSSKeychainErrorCode, EVSSKeychainErrorBadArguments, etc). Screenshot below:
  • I believe above evernote sdk isn't causing the errors I am getting; I could try to remove evernote sdk (directly integrated), but I am not sure about it ??

Errors upon compilation:

  • /path../Pods/SSKeychain/Sources/SSKeychain.h:65:1: Duplicate interface definition for class ‘SSKeychain'

  • /path../Pods/SSKeychain/Sources/SSKeychain.h:22:27: Redefinition of 'SSKeychainErrorCode'

  • /path../Pods/SSKeychain/Sources/SSKeychain.h:24:2: Redefinition of enumerator 'SSKeychainErrorBadArguments'

Please help with the ideas to remove these errors?

回答1:

This was fixed by modifying the import statements for SSKeychain.h