0

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];

I have only the SBJson files that came with the facebook SDK. Can someone help me understand what is happening.

jimbob
  • 3,288
  • 11
  • 45
  • 70

1 Answers1

1

Your "data" should actually be a "NSString" object.

Then you can do something like this (assuming the JSON data is in the variable named "data"):

NSString *json_string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 
if(json_string)
{
    NSDictionary * facebookDict = [json_string JSONValue];
}

Also make sure you "#import "NSString+SBJSON.h"" at the top of the .m file this code lives in.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • this was a interesting solution... I didnt use it in the end but it is a working solution thanks. – jimbob Aug 07 '12 at 12:12