7

I downloaded latest LinkedIn SDK and added to my project but building failed

duplicate symbol _OBJC_METACLASS_$_PodsDummy_Pods in: /linkedin-sdk.framework/linkedin-sdk(Pods-dummy.o) /Build/Products/Debug-iphonesimulator/libPods.a(Pods-dummy.o) duplicate symbol _OBJC_CLASS_$_PodsDummy_Pods in: /linkedin-sdk.framework/linkedin-sdk(Pods-dummy.o) /Build/Products/Debug-iphonesimulator/libPods.a(Pods-dummy.o) ld: 2 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Does anyone know how to fix it?

Rinat
  • 598
  • 1
  • 8
  • 18
  • possible duplicate of [Prevent duplicate symbols when building static library with Cocoapods](http://stackoverflow.com/questions/21249273/prevent-duplicate-symbols-when-building-static-library-with-cocoapods) – Vlad Papko Jul 07 '15 at 04:30
  • Also here is discussion of this issue: https://github.com/CocoaPods/CocoaPods/issues/1767 – Vlad Papko Jul 07 '15 at 04:31
  • This solution solved the same problem for me: http://stackoverflow.com/a/30722343/3820161 – dce Jul 09 '15 at 11:04
  • 2
    @dce do you mean that I should rename all symbols of pod libraries to solve problem. I guess LinkedIn developers should fix it – Rinat Jul 09 '15 at 15:06
  • yeah +1 for @Rinat comment. Why should I change all of my other pods. Such a bad bug for a very late coming library. Haven't they test this case? – mkeremkeskin Jul 10 '15 at 12:01
  • @keremkeskin do you know how to report bug to LinkedIn developers? I couldn't find – Rinat Jul 10 '15 at 15:21

3 Answers3

24

I had the same issue, and found a workaround until the LinkedIn SDK is 'fixed'.

Simply update the Pods-dummy.m file in the Pods Xcode project from:

#import <Foundation/Foundation.h>
@interface PodsDummy_Pods : NSObject
@end
@implementation PodsDummy_Pods
@end

to

#import <Foundation/Foundation.h>
@interface PodsDummy_Podsxx : NSObject
@end
@implementation PodsDummy_Podsxx
@end

and it will then link.

Note: you will need to patch this each time you update your Pods via the command line, e.g. "pod install" or update etc.

Peter Li
  • 274
  • 1
  • 4
3

I can't comment so I will leave this as a reply to @rinat , I didn't need to change the other pods name, just add:

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

to the pod file. Anyways the SDK linkedIn didn't work at all for me. I haven't been able to make it work, it simply doesn't work when authenticating with the app ready. No logs, nothing... I ended implementing a normal OAuth2 web login.

dce
  • 263
  • 1
  • 2
  • 8
3

Hey no need to change PodsDummy_Pods name to PodsDummy_Podsxx each time you update your Pods via the command line, e.g. "pod install" or update etc.

Paste below code in Podfile. linkedIn SDK working cool......

post_install do |installer_representation|
    installer_representation.pods_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