【发布时间】:2012-10-03 18:54:49
【问题描述】:
我已成功提示用户通过 SocialFramework 使用以下方法授予 facebook 权限,但似乎无法检索并显示基本个人资料信息(姓名、电子邮件、ID 等...)我想对此有简单的方法,但找不到它们。任何人都可以在这里提供一些帮助吗?谢谢
-(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);
}
}];
}
【问题讨论】:
-
嗨..你有解决方案吗?我得到空响应。
-
我实际上还没有机会测试/实施以下解决方案。
标签: facebook ios6 social-framework