18

我正在使用iOS Built in框架進行連接。要求"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.} 

這到底是怎麼回事?顯示兩個用戶權限彈出窗口不太理想的用戶體驗。

回答

17

第一次,您必須要求讀取權限。您最初不能以任何類型的發佈/寫入權限來授權用戶。之後你應該做的是,在你的應用中有意義的地方,要求獲得publish_stream權限。絕對不要執行初始權限,然後立即要求獲得publish_stream權限。

請參閱本說明https://developers.facebook.com/docs/tutorial/iossdk/upgrading-from-3.0-to-3.1/的「要求閱讀&單獨寫入權限」一節。即使這適用於iOS的Facebook SDK,它也是內置框架中相同要求的擴展。

+0

我要請@ 「user_about_me」,仍然有這個錯誤。怎麼了 ?? – Stas

+0

當你遇到這個錯誤時,你是否只需要user_about_me?此外,如果你可以提供你使用的代碼,這將有所幫助。 –

+0

感謝問題已經解決。 Facebook上有一些延遲 – Stas

5

我想補充一點,就是在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. 

如果不這樣做會導致同樣的錯誤。

4

在最新的SDK(v3.5)中,您還需要在權限數組中傳遞@「basic_info」。它曾經是隱含的,但不再是。如果不這樣做,你會得到「應用程序必須問一個基本的讀取權限在安裝時」消息

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

從方法文檔:

readPermissions - An array of strings representing the read permissions to request during the authentication flow. 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.

相關問題