使用Facebook android sdk 3.6(最新)发布到朋友墙时发生错误

时间:2014-02-10 13:04:55

标签: android facebook-android-sdk

使用Facebook Android sdk发布到朋友墙时出现以下错误

enter image description here

以下是我编写发布代码的方法。

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 Facebook integrated Android apps.");
        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");
        params.putString("to", "xxxxx81890xxxxx");

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


                @Override
                public void onComplete(Bundle values,
                        FacebookException error) {
                    // TODO Auto-generated method stub

                     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(MainActivity.this.getApplicationContext(),
                                    "Posted story, id: "+postId,
                                    Toast.LENGTH_SHORT).show();
                            } else {
                                // User clicked the Cancel button
                                Toast.makeText(MainActivity.this.getApplicationContext(), 
                                    "Publish cancelled", 
                                    Toast.LENGTH_SHORT).show();
                            }
                        } else if (error instanceof FacebookOperationCanceledException) {
                            // User clicked the "x" button
                            Toast.makeText(MainActivity.this.getApplicationContext(), 
                                "Publish cancelled", 
                                Toast.LENGTH_SHORT).show();
                        } else {
                            // Generic, ex: network error
                            Toast.makeText(MainActivity.this.getApplicationContext(), 
                                "Error posting story", 
                                Toast.LENGTH_SHORT).show();
                        }

                }

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

当我删除此行

params.putString("to", "xxxxx381890xxxxx");

从上面的代码,它已成功发布在我的墙上。任何人都可以建议我如何解决这个问题?我真的不明白我做错了什么。

由于

logcat的:

02-10 19:02:54.567: D/WML_SISO(12014): InitPasteboardJni
02-10 19:02:54.577: W/webcore(12014): java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.
02-10 19:02:54.577: W/webcore(12014):   at android.webkit.WebViewCore$EventHub.removeMessages(WebViewCore.java:2510)
02-10 19:02:54.577: W/webcore(12014):   at android.webkit.WebViewCore$EventHub.access$12800(WebViewCore.java:1219)
02-10 19:02:54.577: W/webcore(12014):   at android.webkit.WebViewCore.removeMessages(WebViewCore.java:2622)
02-10 19:02:54.577: W/webcore(12014):   at android.webkit.WebView.sendOurVisibleRect(WebView.java:3894)
02-10 19:02:54.577: W/webcore(12014):   at android.webkit.ZoomManager.setZoomScale(ZoomManager.java:976)
02-10 19:02:54.577: W/webcore(12014):   at android.webkit.ZoomManager.access$2100(ZoomManager.java:57)
02-10 19:02:54.577: W/webcore(12014):   at android.webkit.ZoomManager$PostScale.run(ZoomManager.java:1509)
02-10 19:02:54.577: W/webcore(12014):   at android.os.Handler.handleCallback(Handler.java:605)
02-10 19:02:54.577: W/webcore(12014):   at android.os.Handler.dispatchMessage(Handler.java:92)
02-10 19:02:54.577: W/webcore(12014):   at android.os.Looper.loop(Looper.java:137)
02-10 19:02:54.577: W/webcore(12014):   at android.app.ActivityThread.main(ActivityThread.java:4517)
02-10 19:02:54.577: W/webcore(12014):   at java.lang.reflect.Method.invokeNative(Native Method)
02-10 19:02:54.577: W/webcore(12014):   at java.lang.reflect.Method.invoke(Method.java:511)
02-10 19:02:54.577: W/webcore(12014):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:985)
02-10 19:02:54.577: W/webcore(12014):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:752)
02-10 19:02:54.577: W/webcore(12014):   at dalvik.system.NativeStart.main(Native Method)

0 个答案:

没有答案