我正在构建一个允许 Facebook 用户创建新事件的应用程序。我注意到我无法在唯一的 Graph API 调用中创建事件并向其添加图像。所以我再次打电话发布图片:
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.my_image);
Bundle params = new Bundle();
params.putParcelable("source", bitmap);
Request postImageRequest = new Request(Session.getActiveSession(), eventId + "/picture", params, HttpMethod.POST, new Callback() {
@Override
public void onCompleted(Response response) {
Log.e("", response.toString());
finish();
}
});
postImageRequest.executeAsync();
但是我从 FB 服务器收到了这个错误响应:
HttpStatus: 400, errorCode: 324, errorType: OAuthException, errorMessage: (#324) Missing or invalid image file}, isFromCache:false