简体   繁体   English

“应用程序必须在安装时请求基本的读取权限”

[英]“The app must ask for a basic read permission at install time”

I am using the iOS Built in frameworks to connect. 我正在使用iOS内置框架进行连接。 After asking for "publish_stream" permissions, FB returns an error: 在询问"publish_stream"权限后,FB返回错误:

Error Domain=com.apple.accounts Code=7 "The Facebook server could not fulfill this access request: The app must ask for a basic read permission at install time." UserInfo=0x145ad6a0 {NSLocalizedDescription=The Facebook server could not fulfill this access request: The app must ask for a basic read permission at install time.}

What is going on here? 这里发生了什么? Showing two user permission popups is a less than ideal user experience. 显示两个用户权限弹出窗口的用户体验不太理想。

The very first time, you must ask for read permissions. 第一次,您必须要求读取权限。 You cannot auth the user initially with any type of publish/write permissions. 您最初无法使用任何类型的发布/写入权限授权用户。 What you should do after that is, where it makes sense in your app, ask for publish_stream permission. 之后您应该做的是,在您的应用中有意义的地方,请求publish_stream权限。 Definitely do not do the initial permission and then immediately ask for the publish_stream permission. 绝对不要做初始权限,然后立即请求publish_stream权限。

See this note in https://developers.facebook.com/docs/tutorial/iossdk/upgrading-from-3.0-to-3.1/ , section "Asking for Read & Write Permissions Separately". 请参阅https://developers.facebook.com/docs/tutorial/iossdk/upgrading-from-3.0-to-3.1/ ,“单独请求读写权限”部分中的此注释。 Even though this applies to the Facebook SDK for iOS it is an extension of the same requirement in the built-in framework. 即使这适用于iOS的Facebook SDK,它也是内置框架中相同要求的扩展。

I would like to add that there is an additional caveat in the Facebook docs: 我想补充一点,Facebook文档中还有一个警告:

// if a user has *never* logged into your app, you MUST include one of
// "email", "user_location", or "user_birthday".  Other read 
// permissions can also be included here.

Failure to do this leads to the same error. 如果不这样做会导致同样的错误。

In the latest SDK (v3.5) you also need to pass @"basic_info" in the permissions array. 在最新的SDK(v3.5)中,您还需要在权限数组中传递@“basic_info”。 It used to be implicit, but not anymore. 它曾经是隐含的,但不再是隐含的。 If you don't, you'll get the "The app must ask for a basic read permission at install time" message 如果不这样做,您将获得“应用程序必须在安装时请求基本读取权限”消息

  [FBSession openActiveSessionWithReadPermissions:@[@"email", @"basic_info"]
                                 allowLoginUI:YES
                            completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
                              [self sessionStateChanged:session state:state error:error];
                            }];

From the method docs: 从方法文档:

readPermissions - An array of strings representing the read permissions to request during the authentication flow. readPermissions - 表示在身份验证流程中请求的读取权限的字符串数组。 The basic_info permission must be explicitly requested at first login, and is no longer inferred, (subject to an active migration.) It is not allowed to pass publish permissions to this method. 必须在首次登录时显式请求basic_info权限,并且不再推断它(受主动迁移限制。)不允许将发布权限传递给此方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM