0

At the moment when I try to have the SBJson library alongside the facebook-ios-sdk I get

'duplicate interface definition for class 'SBJsonParser''

come up.

So I have created a static facebook-ios-sdk library and then I have also got my standard SBJson library in the same project. I get the error.

Can anyone suggest a way to fix this? I really need to use that library in my application... as I already have a good few thousand lines of code in this library and need to implement facebook too...

Almo
  • 15,538
  • 13
  • 67
  • 95
jimbob
  • 3,288
  • 11
  • 45
  • 70

1 Answers1

3

The facebook SDK already contains the SBJSON library. That is why you are getting a duplicate definition error. Try removing your SBJSON files and then #import "SBJSON.h", it should get the file from your facebook SDK.

Try: initWithData:encoding: NSString method.

NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSDictionary *dict = [responseString JSONValue];
ohr
  • 1,717
  • 14
  • 15
  • Ok but I get an error saying "no visible @interface for 'NSData' declares the selector 'JSONValue'" ?? It happens when I have a data stream (NSDAta) NSDictionary * dict = [data JSONValue]; – jimbob Aug 06 '12 at 19:59
  • 1
    Are you sure you can `JSONValue` data? Taken from SBJSON git hub: `Call [str JSONValue] on any NSString instance to parse its JSON text`. I updated my answer. – ohr Aug 06 '12 at 21:03
  • is latest Facebook sdk have this issue? i think now they added prefix "FB" for all SBJson classes used in SDK. Pls refer http://developers.facebook.com/bugs/202230616574138/ or http://stackoverflow.com/questions/12301617/application-crash-on-login-in-ios-facebook-sdk-3-0/12315467#12315467 – Ab'initio Mar 06 '13 at 07:48