繁体   English   中英

无法通过图形Facebook API获取朋友列表

[英]Can't get friend list via graph facebook API

在iOS中使用Graph API获取列表朋友facebook时遇到问题。

我使用/{user-id}/friends来获取列表好友,结果是friends who have used (via Facebook Login) the app making the request好友未列出好友。

之后,我尝试在Graph API Explorer上结识朋友,我得到了预期的结果。

然后,我在Graph API Explorer上使用access_token替换通过iOS中登录获得的access_token。 我也得到了预期的结果。

Graph API Explorer和access_token通过登录获得什么不同?

您可以通过两种方式使用iOS版facebook SDK或使用图谱API实现此目的。

如果您使用的是sdk,则可以按以下方式发出请求

* make the API call */
[FBRequestConnection startWithGraphPath:@"/{friendlist-id}"
                             parameters:nil
                             HTTPMethod:@"GET"
                      completionHandler:^(
                          FBRequestConnection *connection,
                          id result,
                          NSError *error
                      ) {
                          /* handle the result */
                      }];

您将需要用户访问令牌和read_friendlists权限。 您还可以使用图形API资源管理器进行测试

此处提供更多信息: https : //developers.facebook.com/docs/graph-api/reference/v2.2/friendlist

暂无
暂无

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

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