Facebook SDK user_posts:您请求的某些别名不存在

Facebook SDK user_posts: Some of the aliases you requested do not exist

我尝试使用 FB SDK 获取用户帖子,但出现错误。知道哪里出了问题吗?

let gr2 : FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "user_posts", parameters: nil)
gr2.startWithCompletionHandler({ (connection, result2, error) -> Void in

})

我得到的错误是:

(lldb) po error
Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=803, com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
    body =     {
        error =         {
            code = 803;
            "fbtrace_id" = "Fo/ky5BIe7W";
            message = "(#803) Some of the aliases you requested do not exist: user_posts";
            type = OAuthException;
        };
    };
    code = 404;
}, com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=404, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=(#803) Some of the aliases you requested do not exist: user_posts, com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=0}

user_posts 是权限,不是 API 端点。

您需要使用 user_posts 授权用户并使用 /me/posts 端点获取用户帖子。

你真的需要偶尔看看文档,甚至还有示例代码:https://developers.facebook.com/docs/graph-api/reference/v2.6/user/feed

确保您了解权限和 API 端点之间的区别。