1
需要發佈狀態消息,或者用戶是否在facebook上使用該狀態消息選擇了一個圖像而不使用對話框。facebook post image /文字使用圖形api錯誤
final Session sessionfb = ParseFacebookUtils.getSession();
List<String> permissions = sessionfb.getPermissions();
if (!permissions.contains("publish_actions")) {
Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(
FlyTags.this, Arrays.asList("publish_actions"))
.setCallback(newPermissionsCallback).setRequestCode(1);
sessionfb.requestNewPublishPermissions(newPermissionsRequest);
}
else {
Bundle parameters = new Bundle();
parameters.putString("message", mfinalmsg);
parameters.putString("description", "test");
if (imgdata != null) {
parameters.putByteArray("picture", imgdata);
}
new Request(sessionfb, "me/photos/feed", parameters, HttpMethod.POST,
new Request.Callback() {
public void onCompleted(Response response) {
Debug.e("facebook post response",
response.toString());
}
}).executeAsync();
響應:
{Response: responseCode: 500, graphObject: null, error: {HttpStatus: 500, errorCode: 100, errorType: FacebookApiException, errorMessage: Invalid parameter}, isFromCache:false}