2

In the current project, I used SBJSON everywhere and got it working fine with the previous version of iOS Facebook SDK since SBJSON was included in Facebook SDK.

I just upgraded to iOS Facebook SDK version 3.0 and having problem with SBJSON.

The first thing it complaint was about NOT finding SBJSON header file. So I thought, I could manually include the SBJSON lib into the project.

After I did that, then the compiler complaint that the SBJSON symbol was duplicated with the Facebook SDK.

I could not find the SBJSON.h anywhere in FB SDK headers.

So at the end, I went into a loop of problems.

Does anyone know how to solve this issue? The worst case could be that I have to switch to use other JSON library for iOS.

Note: They are using framework for Facebook SDK, not the source code library like before

Cheers

L N
  • 2,856
  • 4
  • 20
  • 30
  • Just remove (untick) one of the SBJSON and related classes instances from your target(s). – James Webster Aug 20 '12 at 15:59
  • The iOS Facebook SDK version 3 is different, there was no SBJSON header or anything like that included in the framework which they are using – L N Aug 20 '12 at 16:02
  • In your compiler error messages, it'll tell you which classes are causing the duplicate symbol, have a look there for clues where to find the cause. – James Webster Aug 20 '12 at 16:04
  • @JamesWebster ld: duplicate symbol _OBJC_CLASS_$_SBJSON in /Users/myname/Documents/FacebookSDK/FacebookSDK.framework/FacebookSDK(SBJSON.o) and /Users/myname/Library/Developer/Xcode/DerivedData/CityWarCocos-akajoekmveidjvfvzmxyfptkmuwh/Build/Intermediates/CityWarCocos.build/Debug-iphonesimulator/CityWarCocos.build/Objects-normal/i386/SBJSON.o for architecture i386 collect2: ld returned 1 exit status Command /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1 – L N Aug 20 '12 at 16:06
  • It tells me that the FacebookSDK header has the duplicate but when I open that file and the other files included in that file, I got nothing related to SBJSON – L N Aug 20 '12 at 16:09

1 Answers1

4

What I ended up using to solve this are two approaches:

The first one

  • Firstly, not using the pre-built Facebook SDK framework that they provided
  • Secondly, check out the Facebook SDK source code from Facebook SDK and integrate it to the project

The second one

Integrate the Json-framework using their source code here and change the name of any duplicate class to something unique to your project like SBJsonParser to MySBJsonParser

L N
  • 2,856
  • 4
  • 20
  • 30