这是我的podFile:
source 'https://github.com/CocoaPods/Specs.git' platform :ios,'7.0' pod 'AFNetworking' pod 'ODSAccordionView','0.4.4' pod 'IQKeyboardManager' pod 'NYXImagesKit',:git => 'https://github.com/Nyx0uf/NYXImagesKit.git' pod 'PEPhotoCropEditor' pod 'CocoaAsyncSocket' pod 'PKRevealController' pod 'Haneke','~> 1.0' pod 'MBProgressHUD','~> 0.9.1' pod 'RadioButton'
Everythig已经很好地工作了很长时间,但是现在,当我更新我的pods(pod更新)时,这3个pod已被提升:
> AFNetworking
> CocoaAsyncSocket
> IQKeyboardManager
在那之后,没有任何作品了.
我为架构i386错误获得了600多个重复符号,如下所示:
duplicate symbol _OBJC_IVAR_$_AFHTTPRequestOperation._responseSerializer in: /Users/myuser/Library/Developer/Xcode/DerivedData/MyProject-emjexnnjljambodthokzwpwcddhz/Build/Products/Debug-iphonesimulator/libPods-AFNetworking.a(AFHTTPRequestOperation.o) /Users/myuser/Library/Developer/Xcode/DerivedData/MyProject-emjexnnjljambodthokzwpwcddhz/Build/Products/Debug-iphonesimulator/libAFNetworking.a(AFHTTPRequestOperation.o) ... (661 times the same error but pointing to different duplicated files) ld: 661 duplicate symbols for architecture i386 clang: error: linker command Failed with exit code 1 (use -v to see invocation)
有任何想法吗?
解决方法
我使用’手动重命名所有符号’的方法.我遇到了重复的符号_OBJC_MetaCLASS _ $_ PodsDummy_Pods,所以我在Podfile中添加了post_install以避免重复的符号.
source 'https://github.com/CocoaPods/Specs.git' platform :ios,'7.0' post_install do |installer_representation| installer_representation.project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited),PodsDummy_Pods=SomeOtherNamePodsDummy_Pods' end end end pod 'AFNetworking' pod 'ODSAccordionView','~> 0.9.1' pod 'RadioButton'
编辑:
从项目中删除以下pod项
1.Pods文件夹
2.Podfile.lock
3.ProjectName.xcworkspace
然后再次安装pod
This hook allows you to make any last changes to the generated Xcode
project before it is written to disk or any other tasks you might
want to perform.
参考 –
1. https://developerinsider.co/cocoapods-remove-duplicate-symbols-errors/
2. http://guides.cocoapods.org/syntax/podfile.html#post_install