0

我是 Android Facebook SDK 3.0 的新手。我正在尝试在https://developers.facebook.com/docs/howtos/androidsdk/3.0/feed-dialog/上遵循本教程,了解如何使用 Feed 对话框。我成功地让登录教程工作,但在本教程中,我不断收到这个问题标题中的错误。我将此方法复制到我的 MainFragment 类中:

private void publishFeedDialog() {
Bundle params = new Bundle();
params.putString("name", "Facebook SDK for Android");
params.putString("caption", "Build great social apps and get more installs.");
params.putString("description", "The Facebook SDK for Android makes it easier and faster to develop");           
params.putString("link", "https://developers.facebook.com/android");
params.putString("picture", "https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png");

WebDialog feedDialog = (
    new WebDialog.FeedDialogBuilder(getActivity(),
        Session.getActiveSession(),
        params))
    .setOnCompleteListener(new OnCompleteListener() {

        @Override
        public void onComplete(Bundle values,
            FacebookException error) {
            if (error == null) {
                // When the story is posted, echo the success
                // and the post Id.
                final String postId = values.getString("post_id");
                if (postId != null) {
                    Toast.makeText(getActivity(),
                        "Posted story, id: "+postId,
                        Toast.LENGTH_SHORT).show();
                } else {
                    // User clicked the Cancel button
                    Toast.makeText(getActivity().getApplicationContext(), 
                        "Publish cancelled", 
                        Toast.LENGTH_SHORT).show();
                }
            } else if (error instanceof FacebookOperationCanceledException) {
                // User clicked the "x" button
                Toast.makeText(getActivity().getApplicationContext(), 
                    "Publish cancelled", 
                    Toast.LENGTH_SHORT).show();
            } else {
                // Generic, ex: network error
                Toast.makeText(getActivity().getApplicationContext(), 
                    "Error posting story", 
                    Toast.LENGTH_SHORT).show();
            }
        }

    })
    .build();
feedDialog.show(); }

对于那些使用 Android Facebook SDK 3.0 的人,我似乎找不到任何关于这个问题的信息。

4

1 回答 1

2

转到您的应用程序设置,单击高级,并确保“流发布 URL 安全性”设置为“禁用”。

于 2013-03-18T17:23:12.317 回答