使用Facebook的Android SDK(v3.6.0)并将登录权限设置为publish_actions
,我正在进行以下简单的调用,以便向用户的Feed帖子发布评论:
String userPostID = postIDParam;
String comment = commentParam;
Session session = Session.getActiveSession();
if (session.isOpened()) {
Bundle bundle = new Bundle();
bundle.putString("message", comment);
Request request = new com.facebook.Request(session, userPostID + "/comments", bundle, HttpMethod.POST, new Request.Callback() {
@Override
public void onCompleted(Response response) {
if (response != null) {
if (response.getError() == null) {
//parse response data
}
else {
//handle error
}
}
}
});
request.executeAsync();
}
该帖子立即成功通过,显示为对指定帖子的评论。然而,奇怪的是,我在代码中收到了500
响应代码和OAuthException
错误消息"An unexpected error has occurred. Please retry your request later"
。因此,我无法在我的应用中正确处理成功的帖子。