我已成功提示用戶授予Facebook權限,使用以下方法通過SocialFramework,但似乎無法檢索並顯示基本檔案信息(名稱,電子郵件,ID等)。 ..)我想有這個簡單的方法,但無法找到它們。任何人都可以提供一些幫助嗎?由於檢索臉書檔案信息iOS6
-(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);
}
}];
}
嗨..你有解決方案嗎?我收到空響應。 –
我實際上還沒有機會測試/實現下面的解決方案。 – Fluffhead