Android Facebook Story回复消息:参数无效

时间:2015-08-10 15:05:41

标签: android facebook facebook-graph-api

我使用facebook样本进行故事发布:

public static void postStory(Activity activity) {
    String fbAppId = activity.getString(R.string.facebook_app_id);
    ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
            .putString("fb:app_id", fbAppId)
            .putString("og:type", "books.book")
            .putString("og:title", "A Game of Thrones")
            .putString("og:description", "In the frozen wastes to the north of Winterfell, sinister and supernatural forces are mustering.")
            .putString("books:isbn", "0-553-57340-3")
            .build();

    ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
            .setActionType("books.reads")
            .putObject("book", object)
            .build();

    ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
            .setPreviewPropertyName("book")
            .setAction(action)
            .build();

    boolean canShare = new ShareApi(content).canShare();
    ShareDialog.show(activity, content);
    ShareApi.share(content, new FacebookCallback<Sharer.Result>() {
        @Override
        public void onSuccess(Sharer.Result result) {
            Log.d(TAG, result.toString());
        }

        @Override
        public void onCancel() { }

        @Override
        public void onError(FacebookException e) {
            Log.d(TAG, e.toString());
        }
    });
}

canShare()返回true, ShareDialog 工作得非常好,但 ShareApi 返回:

  

{FacebookGraphResponseException:无效的参数httpResponseCode:   500,facebookErrorCode:100,facebookErrorType:FacebookApiException,   消息:参数无效}

可能是什么问题?

1 个答案:

答案 0 :(得分:1)

您使用的SDK版本是什么?我们在v4.1.2+中解决了类似于您案例的错误:

  

通过ShareApi共享Open Graph对象可能无法正常进行   阶段嵌套对象。