我正在尝试将我的应用程序更新为从 facebook 图形 API v2.0 获取共同好友的新方法。
在他们的网站上:https://developers.facebook.com/docs/graph-api/reference/v2.0/user.context/mutual_friends
他们推荐使用这个代码:
Bundle params = new Bundle();
params.putString("fields", "context.fields(mutual_friends)");
/* make the API call */
new Request(
session,
"/{user-id}",
params,
HttpMethod.GET,
new Request.Callback() {
public void onCompleted(Response response) {
/* handle the result */
}
}
).executeAsync();
所以我编辑了这段代码以像这样输入用户 ID....
Bundle params = new Bundle();
params.putString("fields", "context.fields(mutual_friends)");
// make the API call
new Request(Session.getActiveSession(), "/{" + userProfile.getString("facebookId") + "}", params, HttpMethod.GET,
new Request.Callback() {
public void onCompleted(Response response) {
/* handle the result */
System.out.println(response.toString());
}
}).executeAsync();
当我运行代码时,我得到这个错误:
{Response: responseCode: 404, graphObject: null, error: {HttpStatus: 404, errorCode: 803, errorType: OAuthException, errorMessage: (#803) 您请求的一些别名不存在:{10102533400666784}}, isFromCache:false
这个别名确实存在。我的请求有什么问题?
最佳答案
错误响应解释了它
{Response: responseCode: 404, graphObject: null, error: {HttpStatus: 404, errorCode: 803, errorType: OAuthException, errorMessage: (#803) 您请求的一些别名不存在:{10102533400666784}}, isFromCache:false
此别名 {10102533400666784}
不存在删除 {}
关于Android获取Facebook共同好友如何填写USER ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24708537/