繁体   English   中英

Android获取Facebook共同朋友如何填写用户ID?

[英]Android Getting Facebook Mutual Friends How To Fill In USER ID?

我正在尝试将我的应用程序更新为从facebook graph 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();

因此,我像下面这样编辑此代码以放入USER 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();

运行代码时,出现以下错误:

{响应:responseCode:404,graphObject:null,错误:{HttpStatus:404,errorCode:803,errorType:OAuthException,errorMessage:(#803)您请求的某些别名不存在:{10102533400666784}},isFromCache:false }

此别名确实存在。 我的要求出了什么问题?

错误响应说明了这一点

{响应:responseCode:404,graphObject:null,错误:{HttpStatus:404,errorCode:803,errorType:OAuthException,errorMessage:(#803)您请求的某些别名不存在:{10102533400666784}},isFromCache:false }

该别名{10102533400666784}不存在,请删除{}

暂无
暂无

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

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