duplicate symbols for architecture x86_64 framework included twice

跟風遠走 提交于 2021-02-11 10:44:44

问题


This is not the regular duplicate symbols error. I am using AFNetworking library for networking with cocoa pods. I also using a third party framework that has been added to the target "Link Binary With Libraries" list in build phases section.

Unfortunately, This third party framework includes the AFNetworking that apparently is being used by it for networking.

Therefore, it makes sense that this error has been produced. Any idea how can this be solved?

Edit: Here it shows that kAFUploadStream3GSuggestedPacketSize symbol is defined in the afnetworking and in the OPPWAMobile framework. along with another 59 symbols.

duplicate symbol _kAFUploadStream3GSuggestedPacketSize in: /Users/khaled/Library/Developer/Xcode/DerivedData/Saveto-fhceqhysbolbskawabayohjbtsra/Build/Products/Debug-iphonesimulator/AFNetworking/libAFNetworking.a(AFURLRequestSerialization.o) /Users/khaled/Development/iOS/Saveto/git@git.assembla.com:imena-develotpment-.29/OPPWAMobile.framework/OPPWAMobile ld: 60 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Podfile:

platform :ios, '7.1'
source 'https://github.com/CocoaPods/Specs.git'

target 'Saveto' do
    pod 'SWTableViewCell', '~> 0.3.7'
    pod 'CocoaLumberjack', '~> 2'
    pod "AFNetworking"   , '~> 2'
    pod 'SDWebImage', '~>3.7'
    pod 'MMDrawerController', '~> 0.6.0'
    pod 'iRate'
    pod 'XLForm'
    pod "SwipeView", "~>1.3.2"
    pod "DAAlertController"
    pod "Mantle" , "~>2.0.4"
    pod 'pop', '~> 1.0'
    pod 'GoogleMaps', '~> 1.12'
    pod 'SVProgressHUD'
    pod 'FXBlurView'
    pod 'Fabric'
    pod 'Crashlytics'
end

回答1:


You are correct about the Pod import of AFNetworking clashing with the 3rd party library which happens to contain the same symbols. There are are couple of ways to resolve it, the best and most sensible one would be to specify use_frameworks! in your Podfile:

platform :ios, '9.0'
use_frameworks!
  target 'Saveto' do
    pod 'SWTableViewCell', '~> 0.3.7'
    pod 'CocoaLumberjack', '~> 2'
    pod 'AFNetworking'   , '~> 2'
    pod 'SDWebImage', '~>3.7'
    pod 'MMDrawerController', '~> 0.6.0'
    pod 'iRate'
    pod 'XLForm'
    pod 'SwipeView', '~>1.3.2'
    pod 'DAAlertController'
    pod 'Mantle' , '~>2.0.4'
    pod 'pop', '~> 1.0'
    pod 'GoogleMaps', '~> 1.12'
    pod 'SVProgressHUD'
    pod 'FXBlurView'
    pod 'Fabric'
    pod 'Crashlytics'
end

I suppose you could also rename the symbols with a post_install method, although that might not resolve everything; there shouldn't be any issues after using the method above though.



来源:https://stackoverflow.com/questions/43965067/duplicate-symbols-for-architecture-x86-64-framework-included-twice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!