Reputation: 7440
I am trying to retrieve the list of facebook friends of a logged user in an Iphone app.
this is the code I am using
[_facebook requestWithGraphPath:@"me/friends" andDelegate:self];
the result I get is a NSDictionary instance with only an object inside.
Am I doing something wrong?
Upvotes: 0
Views: 602
Reputation: 2707
You parse your DIctionary Data.
Sample code here,
if ([result isKindOfClass:[NSDictionary class]]) {
NSArray *userInfoArray=[result objectForKey:@"data"];
NSMutableArray *userIdArray=[[NSMutableArray alloc ]init];
NSMutableArray *userNameArray=[[NSMutableArray alloc ]init];
for (int indexVal=0; indexVal<[userInfoArray count]; indexVal++) {
NSDictionary *individualUserInfo=[userInfoArray objectAtIndex:indexVal];
[userIdArray addObject:[individualUserInfo objectForKey:@"id"]];
[userNameArray addObject:[individualUserInfo objectForKey:@"name"]];
}
NSLog(@"Frnd Name Array : %@ ",userNameArray);
NSLog(@"Id Array : %@ ",userIdArray);
}
Here result is the data you received in request:DidLoad delegate method
Upvotes: 2