10
duplicate symbol _OBJC_METACLASS_$_SBJsonParser in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonParser.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonParser.o)
duplicate symbol _OBJC_CLASS_$_SBJsonParser in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonParser.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonParser.o)
duplicate symbol _OBJC_IVAR_$_SBJsonWriter.sortKeys in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonWriter.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonWriter.o)
duplicate symbol _OBJC_IVAR_$_SBJsonWriter.humanReadable in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonWriter.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonWriter.o)
duplicate symbol _OBJC_METACLASS_$_SBJsonWriter in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonWriter.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonWriter.o)
duplicate symbol _OBJC_CLASS_$_SBJsonWriter in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonWriter.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonWriter.o)
ld: 6 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Please tell me how to fix this issue?

Adil Soomro
  • 37,609
  • 9
  • 103
  • 153
Ali Maisam
  • 239
  • 1
  • 3
  • 15
  • have u give same name to your controls or variable in your project? if not then delete your derived data., then clean and build your project. – Dhruvik Mar 20 '13 at 10:30
  • try this : http://stackoverflow.com/a/42089897/3024579 – Alok Feb 07 '17 at 12:42

9 Answers9

21

As you can see the linker complains that SBJsonWriter and SBJsonParser are both defined in libfacebook_ios_sdk.a and as individual files in your project.

You cannot really solve the problem except removing the individual files from your target.

The problem is that the developers of libfacebook_ios_sdk.a thought it would be a good idea to use the json framework (not caring for clashes with code used in the host app). This is a common problem with SDKs on iOS.

Nikolai Ruhe
  • 81,520
  • 17
  • 180
  • 200
  • But I am using SBJsonWriter and SBJsonParser in my project. – Ali Maisam Mar 20 '13 at 11:21
  • @AliMaisam I understand your conflict, yet there just is no proper solution. You could rename your SBJsonParser and SBJsonWriter classes to avoid the clash. – Nikolai Ruhe Mar 20 '13 at 11:30
  • Sorry to say but I did not get 100% of what you are trying to explain. Could you explain little more, please? – rohan-patel Mar 20 '13 at 11:37
  • @rohan-patel. I just removed SBJsonParser and SBJSonWriter from my project and used Facebook SDK's JSON.h file where needed. And when I removed both the files SBJsonParser was giving out error that: [SBJsonParser objectWithString:error:]: unrecognized selector sent to instance To solve that, I used [SBJsonParser objectWithString:] – Ali Maisam Mar 20 '13 at 12:30
  • Thank you! This helped me a lot too! Turns out the third party library I was using contained another third party library I was also using! And they didn't make that explicit either! So I was stuck on this problem for a looong time. – waylonion Nov 25 '13 at 01:37
  • This helped me a lot, I've encountered this when I add C2Call's SocialCommunication framework and gave me 52 duplicate symbols. Thanks man! – caribbean Dec 05 '13 at 08:10
10

The problem is most likely due to a typo when including the header. Check so that the header file (.h) is included and not the implementation file (.m).

This was the issue for me

joacar
  • 891
  • 11
  • 28
10

I had resolved issues please follow step.

  1. Goto application's target
  2. Compile Sources
  3. Remove duplicate file using (-).enter image description here
Piyush
  • 1,156
  • 12
  • 20
  • This was my issue! Not sure why, but removing the file from the Compile Sources in Build Phases of the Application Target fixed the issue. – Ninja Sep 25 '15 at 21:43
7

Something that often helps if nothing else works is to open your .pbxcodeproj file with a text editor and grep for the name of the class that is coming up in the failure log in Xcode. There might be two duplicate lines - delete one of them.

Trevor Assaf
  • 91
  • 1
  • 3
2

You must have added SBJsonParser.h/.m twice in the project.

Kunal
  • 649
  • 4
  • 13
  • 1
    Who downvoted this answer without providing reason? It is a one of the possible solution for the question asked. – rohan-patel Mar 20 '13 at 10:46
  • 1
    Stackoverflow should consider without reason you cannot downvote, people are very reluctant to downvote any answer just for the sake of it. But they don't appreciate good answers. – iphonic Mar 20 '13 at 10:49
  • 1
    The answer can be a possibility. No damn reason to downvote it. – Anil May 01 '13 at 06:11
0

It seems you probably have some .h/.m file included twice like included some third party API/library twice, or you created some new file whose name is exactly same as already available file in project. Check out if you have any files which is duplicate in your project folder.

rohan-patel
  • 5,772
  • 5
  • 45
  • 68
0

You also can:

  1. Copy .h files of conflict pods.
  2. Delete these conflict pods from podfile.
  3. Copy these .h files to project.
  4. Rename at #import </.h> to ".h" of copied .h files.
  5. Make pod install and bulid.

The trick is your code have no error because .h files imported, but .o files link correctly.

Ivan Vavilov
  • 1,520
  • 1
  • 15
  • 28
0

if you import any of your .h file twice it happens.

For example If you import any .h file both ....ViewController.h and ....ViewController.m file it happens.

zapoo
  • 1,548
  • 3
  • 17
  • 32
0

If above all don't solve your issue, check whether you declare a constant in two different files(I mean check if you have two same(.h &.m) files. Duplicate files should not be there in your project.

Narasimha Nallamsetty
  • 1,215
  • 14
  • 16