我从具有基本个人资料和朋友列表权限的设置中获取FB用户列表。它工作正常。但警报显示文字如下:
“应用名称”希望代表您访问您的基本个人资料信息和朋友列表。此外,它还想访问您的基本个人资料信息和朋友列表。“
代码有什么问题吗?
ACAccountType *FBaccountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSString *key = FACEBOOK_APP_ID;
NSMutableDictionary *dictFB = [NSMutableDictionary dictionaryWithObjectsAndKeys:key,ACFacebookAppIdKey,@[@"email", @"user_friends", @"public_profile"],ACFacebookPermissionsKey, nil];
[accountStore requestAccessToAccountsWithType:FBaccountType options:dictFB completion:
^(BOOL granted, NSError *e)
{
if (granted)
{
self.facebookAcconts = [[accountStore accountsWithAccountType:FBaccountType]mutableCopy];
if (self.facebookAcconts.count > 0)
{
id account = [self.facebookAcconts objectAtIndex:0];
if (account)
{
[accountStore renewCredentialsForAccount:account completion:^(ACAccountCredentialRenewResult renewResult, NSError *error) {
if(!error)
{
switch (renewResult) {
case ACAccountCredentialRenewResultRenewed:
break;
case ACAccountCredentialRenewResultRejected:
NSLog(@"User declined permission");
break;
case ACAccountCredentialRenewResultFailed:
NSLog(@"non-user-initiated cancel, you may attempt to retry");
break;
default:
break;
}
}
else{
//handle error gracefully
NSLog(@"error from renew credentials%@",error);
}
}];
}
}
}
}];