0

I use facebook graph API, with the help of that, I get user friends list what I wanted. It is in JSON Format. As I do earlier I import json classes in my project I used the following method. But it throws an error which I don't understand what exactly I am missing here.

My Code:

-(void)getuserfriends
{
NSDictionary *dict = [[NSDictionary alloc]initWithObjectsAndKeys:@"name,last_name,first_name",@"fields", nil];   
FbGraphResponse *fb_graph_response =  [fbGraph doGraphGet:@"me/friends" withGetVars:dict];  
NSLog(@"getMeFriendsButtonPressed:  %@",fb_graph_response.htmlResponse);
//htmlresponse is string
NSMutableDictionary *newdict = [fb_graph_response.htmlResponse JSONValue];
}

Error: Receive type NSString for instance message does not declare a method with selector 'JSONValue'

Ilanchezhian
  • 17,426
  • 1
  • 53
  • 55
mashios
  • 70
  • 6

1 Answers1

0

It's because NSString does not have JSONValue method. You must use JSON API who parse a string and return NSDictionary.

When you do this :

fb_graph_response.htmlResponse;

That return an NSString. And you call JSONValue who don't exist.

Community
  • 1
  • 1
TheRonin
  • 1,305
  • 1
  • 12
  • 18