Chris Lin
Chris Lin

Reputation: 709

how to retrieve Facebook friend's group name?

Facebook SDK 3.+ has requestForMyFriends, and return FBGraphUser but it doesn't have a group name property, is there a way to get all the groups belongs to the user?

Upvotes: 2

Views: 107

Answers (1)

Tommy Devoy
Tommy Devoy

Reputation: 13549

You could easily grab all of a user's groups using the FB Open Graph and SLRequests. Ensure that you've already authenticated and then make the call like this:

NSURL *groups = [NSURL URLWithString:@"https://graph.facebook.com/me/groups"];

SLRequest *retrieveGroups = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:groups parameters:nil];

[retrieveGroups performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error)
{
//responseData contains your groups 
}];

Upvotes: 2

Related Questions