我们正在使用restfb 1.6.14。我在获取公共帖子时收到以下错误。
com.restfb.exception.FacebookOAuthException: Received Facebook error response of
type OAuthException: An unexpected error has occurred. Please retry your reques
t later. (code 2, subcode null)
at com.restfb.DefaultFacebookClient$DefaultGraphFacebookExceptionMapper.
exceptionForTypeAndMessage(DefaultFacebookClient.java:964)
at com.restfb.DefaultFacebookClient.throwFacebookResponseStatusException
IfNecessary(DefaultFacebookClient.java:885)
at com.restfb.DefaultFacebookClient.makeRequestAndProcessResponse(Defaul
tFacebookClient.java:824)
at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.ja
va:765)
at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.ja
va:729)
at com.restfb.DefaultFacebookClient.fetchConnection(DefaultFacebookClien
t.java:271)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
使用以下代码获取访问令牌
AccessToken accessToken = new
DefaultFacebookClient().obtainAppAccessToken(appid,appsecret);
String token=accessToken.getAccessToken();
使用以下源代码获取公开信息
public Connection<Post> publicSearchMessages(String keyword, int limit) {
Connection<Post> messages = fbClient.fetchConnection("search",
Post.class, Parameter.with("q", keyword),
Parameter.with("limit", limit), Parameter.with("type", "post"));
return messages;
}
为什么会出现此错误?我该如何解决这个错误?
答案 0 :(得分:0)
使用Graph API 2.0,您不能搜索帖子,甚至是公开的帖子。