获取Facebook时间表

时间:2015-05-20 09:06:54

标签: facebook facebook-graph-api permissions facebook-timeline review

我从Facebook获取时间线,我成功地获得了我的时间线,但当我使用我朋友的Facebook帐户登录时,我收到以下错误 -

{
  "error": {
    "message": "(#200) Requires extended permission: read_stream", 
    "type": "OAuthException", 
    "code": 200
  }
}

我是Facebook开发者的应用程序管理员,但我的朋友不是。 我已经批准了Facebook的以下权限(参见随附的屏幕截图)

enter image description here 以下是我在我的代码中使用的权限 -

FBSession* sess = [[FBSession alloc] initWithPermissions:[NSArray arrayWithObjects:@"public_profile",@"user_friends",@"user_birthday",@"email",@"user_education_history",@"user_work_history",@"user_hometown",@"read_stream",@"user_about_me",@"user_posts",@"publish_actions",nil]];

以下是获取时间表的代码 -

 NSString *urlStringFacebook = [NSString stringWithFormat:@"https://graph.facebook.com/me/home?format=json&&access_token=%@&&limit=90",[[FBSession activeSession] accessTokenData]];

如果我提交read_stream权限给Facebbok进行审核,则由于以下原因拒绝它(见下面的屏幕截图) -

enter image description here

还有一件事,当我使用我的帐户登录时,他们要求我允许新闻提要(read_stream)权限,但当我的朋友登录时,他们不会要求获得该许可。

当我尝试在Graph API资源管理器上获得相同的内容时,数据就可以了。 请让我知道整个过程中我缺少的东西。 感谢

3 个答案:

答案 0 :(得分:2)

您可以使用user_posts获取主页时间轴帖子。

enter image description here

使用/me/feed,您可以收到其他人和您的所有帖子。转到开发人员图形API Explorer Graph API Explorer

答案 1 :(得分:2)

您正在尝试使用/me/home,这需要read_stream,因为您可以在文档中阅读:https://developers.facebook.com/docs/graph-api/reference/user/home

...并且该权限不会获得批准:https://developers.facebook.com/docs/facebook-login/permissions/v2.3#reference-read_stream

请改为使用/me/posts/me/feed,这些端点需要user_posts并且您已获得该许可已获批准https://developers.facebook.com/docs/graph-api/reference/v2.3/user/feed

顺便说一句,这在更新日志中得到了很好的解释:https://developers.facebook.com/docs/apps/changelog#v2_3_new_features

答案 2 :(得分:1)

使用/me/feed代替/me/home,使用已授予的user_posts权限,这应该有效。此端点还会返回用户时间轴中的其他帖子,而不仅仅是用户自己的帖子(/me/posts)......

相关问题