2013-03-10 62 views
0

我不熟悉Android Facebook SDK 3.0。我試圖按照本教程https://developers.facebook.com/docs/howtos/androidsdk/3.0/feed-dialog/關於使用Feed對話框。我成功地獲得了登錄教程,但在本教程中,我不斷收到此問題標題中的錯誤。我複製這個方法到我MainFragment類:Android Facebook SDK 3.0教程:「帖子的鏈接必須直接指向應用程序的連接或畫布URL」

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的東西。

回答

2

轉到您的應用程序設置,點擊高級,並確保「Stream post URL security」設置爲「Disabled」。

相關問題