Retrieving Facebook Friend List

I want to get a list of friends of users from Facebook. Any code sample would be highly appreciated.

+6
source share
3 answers

after logging in, [facebook requestWithGraphPath: @ "me / friends" andDelegate: self]; // friend data must understand this delegate method.

- (void)request:(FBRequest *)request didLoad:(id)result { if([result isKindOfClass:[NSDictionary class]]) { NSLog(@"dictionary"); result=[result objectForKey:@"data"]; if ([result isKindOfClass:[NSArray class]]) for(int i=0;i<[result count];i++){ NSDictionary *result2=[result objectAtIndex:i]; NSString *result1=[result2 objectForKey:@"id"]; NSLog(@"uid:%@",result1); [uids addObject:result1]; } } } 

here, i added all the friends uids to the array. In the same way, u can get names and do any use of GraphApi.

Hope this helps you ...

+9
source

use api chart for requestwithgraphapi string @ "me / friends" .

this is for friends followers.

friendlists

User Friends List

Requires read_friendlists permission to read and manage_friendlists write

so add them to ur permissions array

an array of objects containing the id and name fields in the friends list

+2
source

Use the FacebookGraph API to get a list of user's friends.

+1
source

All Articles