Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcode duplicate symbols for architecture error after updating cocoa pods

Here is my 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 has been working fine for a long time, but now, when I update my pods (pod update) these 3 pods get uptated:

  • AFNetworking
  • CocoaAsyncSocket
  • IQKeyboardManager

After that, nothing works anymore.

I get more than 600 duplicate symbols for architecture i386 errors, like this one:

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)

Any ideas?

EDITED: After doing the solution shown below, my project only compiles for iPad Air and I can not Archive anymore, i still get the same error...

like image 742
Ale Avatar asked Sep 16 '15 10:09

Ale


2 Answers

I use the 'Manually Rename All of the Symbols' approach. I was experiencing the duplicate symbol _OBJC_METACLASS_$_PodsDummy_Pods and so i added the post_install in the Podfile to avoid the duplicate symbol.

Replace your pod file content with this to 'Manually Rename All of the Symbols'

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.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'

Edited : Delete the following pod item's from your project

1.Pods Folder

2.Podfile.lock

3.ProjectName.xcworkspace

And then install the pods again

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.

Reference -
1. https://developerinsider.co/cocoapods-remove-duplicate-symbols-errors/
2. http://guides.cocoapods.org/syntax/podfile.html#post_install

like image 180
Vineet Choudhary Avatar answered Nov 02 '22 23:11

Vineet Choudhary


Even after deleting my pods and reinstalling them, I had always the same problem.

I finally found the solution by comparing with another project. The issue was in the parameter "Other Linker Flags" (OTHER_LDFLAGS) in the Build Settings of the project. The pods were referenced not just by their name, but by adding the prefix "Pods-myProject"

"-l\"Pods-myProject-AMSlideMenu\"",
"-l\"Pods-myProject-CocoaLumberjack\"",
"-l\"Pods-myProject-DLAlertView\""

So I just removed the prefix and all was right

"-l\"AMSlideMenu\"",
"-l\"CocoaLumberjack\"",
"-l\"DLAlertView\""
like image 25
Omaty Avatar answered Nov 03 '22 00:11

Omaty