我已成功提示用户通过 SocialFramework 使用以下方法授予 facebook 权限,但似乎无法检索并显示基本个人资料信息(姓名、电子邮件、身份证等......)我想有简单方法,但找不到它们。任何人都可以在这里提供一些帮助吗?谢谢
-(IBAction)getInfo:(id)sender{
NSLog(@"FIRING");
ACAccountStore *_accountStore = [[ACAccountStore alloc] init];
ACAccountType *facebookAccountType = [_accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
// We will pass this dictionary in the next method. It should contain your Facebook App ID key,
// permissions and (optionally) the ACFacebookAudienceKey
NSDictionary *options = @{ACFacebookAppIdKey : @"284395038337404",
ACFacebookPermissionsKey : @[@"email"],
ACFacebookAudienceKey:ACFacebookAudienceOnlyMe};
// Request access to the Facebook account.
// The user will see an alert view when you perform this method.
[_accountStore requestAccessToAccountsWithType:facebookAccountType
options:options
completion:^(BOOL granted, NSError *error) {
if (granted)
{
NSLog(@"GRANTED");
// At this point we can assume that we have access to the Facebook account
NSArray *accounts = [_accountStore accountsWithAccountType:facebookAccountType];
// Optionally save the account
[_accountStore saveAccount:[accounts lastObject] withCompletionHandler:nil];
}
else
{
NSLog(@"Failed to grant access\n%@", error);
}
}];
}