gpt4 book ai didi

android - Facebook Graph API 调用未检索所有字段

转载 作者:搜寻专家 更新时间:2023-11-01 08:37:49 26 4
gpt4 key购买 nike

我正在请求我的我/相册:

  new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/me/albums",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
parseAlbumResponse(response);
}
}).executeAsync();

问题是响应对象只包含 3 个字段:

{
"data": [
{
"created_time": "...",
"name": "...",
"id": "..."
},
...

而不是记录所有字段 here . /{album-id}/photos 也是如此:

{
"data": [
{
"created_time": "...",
"id": "..."
},
...

而不是 this .上次我检查时它工作正常,但突然间发生了这种奇怪的行为。我用 Facebook Graph API 测试过结果是一样的,所以我想这不是我的应用程序的问题。

我正在使用 'com.facebook.android:facebook-android-sdk:4.7.0'。Facebook 是否更改了请求参数中的某些内容?

编辑:正如用户 luschn 所建议的那样:

Declarative Fields

To try to improve performance on mobile networks, Nodes and Edges in v2.4 requires that you explicitly request the field(s) you need for your GET requests. For example, GET /v2.4/me/feed no longer includes likes and comments by default, but GET /v2.4/me/feed?fields=comments,likes will return the data. For more details see the docs on how to request specific fields.

所以我不得不将我的请求更改为:
网络控制台:
me/albums?fields=name, cover_photo, count/{album-id}/photos?fields=id, images

Java:

Bundle parameters = new Bundle();
parameters.putString("fields", "id, images");

Bundle parameters = new Bundle();
parameters.putString("fields", "name, cover_photo, count");

最佳答案

https://developers.facebook.com/docs/apps/changelog#v2_4

在变更日志中搜索“声明字段”,您必须指定要返回的字段。

关于android - Facebook Graph API 调用未检索所有字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35271047/

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