Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pod update results in "duplicate interface definition for class xxx" for all AWS SDK (El Capitan + XCode 7)

Just now, I updated my AWS SDK pods, which I regretted so much. I first saw this when pods were being updated:

dyld: warning, LC_RPATH @executable_path/../../../../../../../SharedFrameworks in /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/../../..//DVTInstrumentsFoundation.framework/Versions/A/DVTInstrumentsFoundation being ignored in restricted program because of @executable_path dyld: warning, LC_RPATH @executable_path/../lib in /Applications/Xcode.app/Contents/Frameworks/IDEFoundation.framework/Versions/A/../../../../Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib being ignored in restricted program because of @executable_path

dyld: warning, LC_RPATH @executable_path/../lib in /Applications/Xcode.app/Contents/Frameworks/IDEFoundation.framework/Versions/A/../../../../Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib being ignored in restricted program because of @executable_path

dyld: warning, LC_RPATH @executable_path/../Frameworks in /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/MacOS/Xcode3Core being ignored in restricted program because of @executable_path

Then when I opened my project and build, I got so many so many build failures, complaining the same thing Duplicate interface definition for class XXX:

enter image description here

I have tried many solutions, reinstall AWS SDK pods, reinstall cocoapods, downgrade cocoapods to 0.38.2, downgrade AWS SDK pods to 2.2.6, but none helps. If I comment out the imports in Objective-C bridge header, I don't have these errors but Xcode just complaints about not finding some of the classes used in the codes. But I don't think commenting them out is the right solution. enter image description here

Well, I searched https://github.com/CocoaPods/CocoaPods/issues/4302, and it seems it could be cocoapods' problem?

Anyone has any idea on this? Thanks.

like image 307
leonard Avatar asked Oct 20 '22 00:10

leonard


1 Answers

Answer (hopefully :))

  • remove the #import from the bridging header
  • add "import AWSS3" (or whichever class you need) in the appropriate Swift files

Explanation

Since version 0.36 of Cocoapods, you don't need to import pods via the bridging header if they are in Swift code OR if they declare "use_frameworks!" (which AWS did in their version 2.2.1

Edit

In my case, I replaced "pod 'AWSiOSSDKv2', '~> 2.0'" with "pod 'AWSS3', '~> 2.2.0'" and added "#import " in the bridging file.

like image 133
Arnaud Avatar answered Oct 22 '22 21:10

Arnaud