Skip to content

Instantly share code, notes, and snippets.

@wbroek
Created September 18, 2012 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wbroek/3744808 to your computer and use it in GitHub Desktop.
Save wbroek/3744808 to your computer and use it in GitHub Desktop.
iOS 6 Facebook Open Graph call
ACAccountStore *store = [[ACAccountStore alloc] init];
ACAccountType *facebookAccountType = [store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSDictionary *FacebookOptions = @{ACFacebookAppIdKey: @"XXXXXXXXXX",ACFacebookPermissionsKey: @[@"email"],ACFacebookAudienceKey:ACFacebookAudienceEveryone};
[store requestAccessToAccountsWithType:facebookAccountType options:FacebookOptions completion:^(BOOL granted, NSError *error) {
if (granted)
{
NSArray *accounts = [store accountsWithAccountType:facebookAccountType];
if ([accounts count]>0) {
ACAccount *facebookAccount = [accounts lastObject];
SLRequest *facebookRequest = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:[NSURL URLWithString:@"https://graph.facebook.com/me"] parameters:@{@"":@""}];
[facebookRequest setAccount:facebookAccount];
[facebookRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
// Read the returned response
}];
}
}
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment