Facebook restFB不再工作了?

时间:2018-05-23 10:43:06

标签: java facebook facebook-graph-api restfb

我已经为java下载了restFB 2.0.0,它在Facebook丑闻之前工作正常。基本上我必须从页面中检索一些交通信息。它上个月工作正常但不是我有这个错误



Caused by: com.restfb.exception.FacebookOAuthException: Received Facebook error response of type OAuthException: (#10) To use 'Page Public Content Access', your use of this endpoint must be reviewed and approved by Facebook. To submit this 'Page Public Content Access' feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review. (code 10, subcode null)
	at com.restfb.exception.generator.DefaultFacebookExceptionGenerator$DefaultGraphFacebookExceptionMapper.exceptionForTypeAndMessage(DefaultFacebookExceptionGenerator.java:174)
	at com.restfb.exception.generator.DefaultFacebookExceptionGenerator.throwFacebookResponseStatusExceptionIfNecessary(DefaultFacebookExceptionGenerator.java:59)
	at com.restfb.DefaultFacebookClient.makeRequestAndProcessResponse(DefaultFacebookClient.java:987)
	at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:909)
	at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:871)
	at com.restfb.DefaultFacebookClient.fetchObject(DefaultFacebookClient.java:408)
	at gis_map.Facebook.getPostFromComplaintsSystem(Facebook.java:217)




这是我之前从页面中检索信息时使用的代码

    public int getElementMauritiusTrafficAlert() throws ParseException {
    FacebookClient fbClient = new DefaultFacebookClient(accessToken);
    Page page = fbClient.fetchObject("1368529399900469", Page.class);

    Connection<Post> postFeed = fbClient.fetchConnection(page.getId() + "/feed", Post.class, Parameter.with("since", Today));
    for (List<Post> postPage : postFeed) {
        for (Post aPost : postPage) {

            list.add(aPost.getMessage() + "\n" + aPost.getCreatedTime());

        }

    }
    return list.size();
}

我真的不知道这个API出了什么问题,因此我的整个应用程序都没有开始。我试图评论我使用api的功能,但它仍然抛出这个错误。请帮忙!

1 个答案:

答案 0 :(得分:0)

您的应用需要“页面公共内容访问”功能,如错误消息所示。与RestFB无关。

https://developers.facebook.com/docs/apps/review/feature#reference-PAGES_ACCESS