问题
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?
回答1:
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.
回答2:
I had resolved issues please follow step.
- Goto application's target
- Compile Sources
- Remove duplicate file using (-).
回答3:
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
回答4:
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.
回答5:
You must have added SBJsonParser.h/.m twice in the project.
回答6:
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.
回答7:
You also can:
- Copy
.h
files of conflictpods
. - Delete these conflict
pods
frompodfile
. - Copy these
.h
files to project. - Rename at
#import
</.h>
to".h"
of copied.h
files. - Make
pod install
and bulid.
The trick is your code have no error because .h
files imported, but .o
files link correctly.
回答8:
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.
回答9:
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.
来源:https://stackoverflow.com/questions/15520921/6-duplicate-symbols-for-architecture-i386