我们正在使用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;
}
为什么会出现这个错误?我该如何解决这个错误呢?