Reputation: 27
I just included AWSIOSSDK.framework and Facebook SDK together in my project, then got a build error:
ld: duplicate symbol _OBJC_METACLASS_$_SBJsonParser in /Users/tom8/Desktop/site1/site1/facebook-ios-sdk/libfacebook_ios_sdk.a(SBJsonParser.o) and /Users/tom8/Desktop/AWSiOSSDK.framework/AWSiOSSDK(SBJsonParser.o) for architecture i386
I use iOS Facebook SDK Static Library, so i could not simply delete sbjson files in facebooksdk folder. I also tried to delete sbjson files in AWSIOSSDK folder, but it also did not work. Could someone give me some advice?
Upvotes: 0
Views: 1882
Reputation: 26
I had the same problem too. You can delete the files from the Facebook Project itself, but you cannot delete from the framework.
So click:
facebook-ios-sdk.xcodeproj (to open up file contents) -> FBConnect (to view folder contents) -> JSON (to view folder contents) -> remove SBJsonWriter and SBJsonParser.
Try compiling. You should be good to go!
Eva
Upvotes: 0
Reputation: 18290
Almost without exception, when I get duplicate symbol build errors, it's because I was #include-ing .h files too prolifically from other .h files. The solution is almost always these two simple steps:
The only cases where you need to #include an .h from an .h is when you actually extend a class or implement a protocol. If you just need to use a class name or protocol name in a signature, use forward declarations and move the #include to the .m file.
Example:
foo.h
#include "Bar.h"
#include "BazProtocol.h"
#include "BarDelegateProtocol.h"
@interface Foo:NSObject <BarDelegate>
@property (strong, nonatomic) id<Baz> myBaz;
@property (strong, nonatomic) Bar *myBar;
@end
becomes
#include "BarDelegateProtocol.h"
@class Bar;
@protocol Baz;
@interface Foo:NSObject
@property (strong, nonatomic) id<Baz> myBaz;
@property (strong, nonatomic) Bar *myBar;
@end
Upvotes: 1