我正在尝试使用以下方法将照片发布到页面:
FacebookClient client = new DefaultFacebookClient(destinationAccessToken);
BinaryAttachment attachment = BinaryAttachment.with(imageName, imageInputStream);
Photo photoResponse = client.publish("/me/photos", Photo.class, attachment);
我收到以下回复:
{
"error": {
"message":"An unexpected error has occurred. Please retry your request later.",
"type":"OAuthException",
"code":2
}
}
当我使用相同的代码发布到用户墙上时,它工作正常。
我也尝试过发布到 "/{page id}/photos"
,结果相同。
目标访问 token 具有 manage_pages
、photo_upload
、publish_actions
和 publish_stream
等权限。
我在这里做错了什么?
更新:
如果我使用 "/{album id}/photos"
发布到预定相册,那么它就可以工作。引用 this Facebook developer blog post :
https://graph.facebook.com/USER_ID/photos
- The photo will be published to an album created for your app. We automatically create an album for your app if it does not already exist. All photos uploaded this way will then be added to this same album.
那么页面的这种行为是否被破坏了?还是我误解了什么?
更新 2:
我找到了一个 bug report对于这个问题,所以我将其作为答案发布。
更新 3:
这个错误似乎已经解决了。
最佳答案
我找到了与此行为对应的 Facebook 错误报告:
http://developers.facebook.com/bugs/355536551171535
所以看起来我没有做错任何事。我想临时的解决方法是检查预定的专辑并在必要时创建它,然后发布到它。 (请注意,此解决方法不需要 user_photos
权限,因为页面上的相册/照片始终是公开的)。
关于java - 将照片发布到页面时出现意外错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10457292/