Created
October 24, 2012 23:11
-
-
Save caabernathy/3949527 to your computer and use it in GitHub Desktop.
Facebook SDK 3.1 for iOS - get a list of friends using the app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) getAppUsers { | |
FBRequest *appUsersRequest = [[FBRequest alloc] | |
initWithSession:FBSession.activeSession | |
restMethod:@"friends.getAppUsers" | |
parameters:nil | |
HTTPMethod:@"GET"]; | |
FBRequestConnection *appUsersConnection = [[FBRequestConnection alloc] init]; | |
[appUsersConnection | |
addRequest:appUsersRequest | |
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { | |
// Process the results | |
NSMutableArray *friendsWithApp = [[NSMutableArray alloc] init]; | |
// Many results | |
if ([result isKindOfClass:[NSArray class]]) { | |
[friendsWithApp addObjectsFromArray:result]; | |
} else if ([result isKindOfClass:[NSDecimalNumber class]]) { | |
[friendsWithApp addObject: [result stringValue]]; | |
} | |
}]; | |
[appUsersConnection start]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment