使用Accounts框架访问Facebook时限制权限

Leg*_*las 11 cocoa-touch objective-c ios facebook-login acaccount

我需要一些帮助....

所以我面临的问题是,从ACAccount获取Facebook帐户时,警报视图会通知太多权限.当我使用ACAccount登录facebook时,我收到警告框.

它说 APP_NAME would like to access your basic profile info and list of friends

即使我的权限集是一个空数组,这也会显示出来.

NSArray * FB_PERMISSIONS = @[];
// or FB_PERMISSIONS = @[@"public_profile", @"likes", @"email"];
// It does not matter what the array is -> The alert has extra sentences.

ACAccountType *FBaccountType= [_accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSString *key = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"FacebookAppID"];;
NSDictionary *dictFB = [NSDictionary dictionaryWithObjectsAndKeys:key,ACFacebookAppIdKey,FB_PERMISSIONS,ACFacebookPermissionsKey, nil];
[_accountStore requestAccessToAccountsWithType:FBaccountType options:dictFB completion:
Run Code Online (Sandbox Code Playgroud)

我想在这做什么?

我只需要" public_profile ",@" email "和" likes ".警报说APP_NAME would like to access your profile, and likes on your behalf. In addition, APP_NAME would like to access your basic profile info and list of friends

为什么那第二句呢?我怎么摆脱它?我可以看到许多应用程序,其中第二行谈论基本配置文件和朋友列表没有显示.

预期结果:

APP_NAME would like to access your profile and likes.

更新:

检查我的答案解决方案.

Leg*_*las 5

FB SDK文档中没有任何内容可以解释这些内容.他们这样做,以便用户可以使用Facebook pop UI并选择他们想要授权的权限.我想Facebook设计的理念是为用户提供尽可能多的控制和透明度.但是在操作系统弹出窗口中,它隐藏了很多权限.我想Apple的设计理念是展示最少的信息.这对于开发人员场景最有效,因为当用户看到应用程序询问了如此多的权限时,用户通常会惊慌失措.

无论如何,如果你看看FBSDKLoginManager+Internal.h你可以检查系统登录的功能.进一步挖掘,我发现FBSDKLoginButton毫无意义.解决此问题的最佳方法是使用您自己的FBSDKLoginManager实例,并将系统帐户类型设置为本机,如果您获得error code 306,则回退到默认登录机制.

不知何故 - >>这种方式不显示其他权限.我不知道怎么做.我所知道的是现在一切都到位了.

此外,您必须设置一个单独的侦听器,ACAccountStoreDidChangeNotification以便您可以绑定一些边缘情况.但是,是的,\ m /