facebook4j post 来自为空
facebook4j post from is null
我正在使用来自 Java 的 Facebook API 和 Facebook4j。
我有两台服务器,其中一台使用 Facebook 2.3 API 当我从 post,
Post post = connection.getFeed().get(0);
post.getFrom();
我得到了用户,但是在使用 Facebook 2.4 API 的服务器中,from 为空。
有什么想法吗?我在 fb API.
中没有看到任何记录在案的更改
如 Facebook Platform Changelog 中所述,从 v2.4 开始,如果要检索字段,您现在必须手动指定字段:
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.
根据docs on Post
,相关字段被命名为from
。要使用 Facebook4J 在 me feed 中请求此字段,您可以使用 Reading
对象,如下所示:
facebook.getFeed(new Reading().fields("from"))
我正在使用来自 Java 的 Facebook API 和 Facebook4j。
我有两台服务器,其中一台使用 Facebook 2.3 API 当我从 post,
Post post = connection.getFeed().get(0);
post.getFrom();
我得到了用户,但是在使用 Facebook 2.4 API 的服务器中,from 为空。
有什么想法吗?我在 fb API.
中没有看到任何记录在案的更改如 Facebook Platform Changelog 中所述,从 v2.4 开始,如果要检索字段,您现在必须手动指定字段:
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, butGET /v2.4/me/feed?fields=comments,likes
will return the data. For more details see the docs on how to request specific fields.
根据docs on Post
,相关字段被命名为from
。要使用 Facebook4J 在 me feed 中请求此字段,您可以使用 Reading
对象,如下所示:
facebook.getFeed(new Reading().fields("from"))