gpt4 book ai didi

ANDROID FACEBOOK SDK-4.0 : I get an error when i use "/me?fields=age_range" in my GraphRequest. newGraphPathRequest

转载 作者:行者123 更新时间:2023-11-29 17:37:08 26 4
gpt4 key购买 nike

  1. 我需要从 facebook 获取 age_range
  2. 当我在我的 GraphRequest.newGraphPathRequest 中使用 /me?fields=age_range 时,出现错误。
  3. 错误是 graphObject 返回 null。我已经尝试使用 /me 并且它有效,但当我使用 /me?fields=age_range 时我得到了正确的用户数据,我得到了这个错误。

Testing﹕ {Response: responseCode: 400, graphObject: null, error: {HttpStatus: 400, errorCode: 2500, errorType: OAuthException, errorMessage: An active access token must be used to query information about the current user.}}


这是我一直试图修复的代码。

         GraphRequest request = GraphRequest.newGraphPathRequest(accessToken,
"/me?fields=age_range",
new GraphRequest.Callback() {
@Override
public void onCompleted(GraphResponse graphResponse) {

Log.v("Testing", graphResponse.toString());


}
});
request.executeAsync();

最佳答案

您不应将“/me?fields=age_range”作为您的 GraphRequest 中的路径。

而是只使用“/me”作为路径,然后创建一个新的Bundle,并将“fields”作为键,将“age_range”作为字符串值,并将新的bundle作为参数设置在图形请求。

GraphRequest request = ...
...
Bundle params = new Bundle();
params.putString("fields", "age_range");
request.setParameters(params);
request.executeAsync();
...

关于ANDROID FACEBOOK SDK-4.0 : I get an error when i use "/me?fields=age_range" in my GraphRequest. newGraphPathRequest,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30105724/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com