2013-03-05 509 views
1

我每次嘗試通過Facebook JS Sdk調用發送對話時都會收到此錯誤。Facebook api返回錯誤代碼100

API錯誤代碼:100 API錯誤描述:無效參數 錯誤消息:'link'無效。

這是我的代碼。

初始化

 window.fbAsyncInit = function() { 
      // init the FB JS SDK 
      FB.init({ 
       appId  : '${sp.apiKey}', // App ID from the App Dashboard 
       //  channelUrl : 'http://localhost:8084/facebook/callback', // Channel File for x-domain communication 
       status  : true, // check the login status upon init? 
       cookie  : true, // set sessions cookies to allow your server to access the session? 
       xfbml  : true // parse XFBML tags on this page? 
      }); 

      // Additional initialization code such as adding Event Listeners goes here 

     }; 
     (function(d, debug){ 
      var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; 
      if (d.getElementById(id)) {return;} 
      js = d.createElement('script'); js.id = id; js.async = true; 
      js.src = "//connect.facebook.net/en_US/all" + (debug ? "/debug" : "") + ".js"; 
      ref.parentNode.insertBefore(js, ref); 
     }(document, /*debug*/ true)); 

發送對話框功能

function sendFacebookMessage(id, jobid){ 

      FB.ui({ 
       method: 'send', 
       name: 'Some text here.', 
       to:id, 
       link: 'www.some-url.com' 

       //tomcat is running on port 8084 
      }); 
     } 

我已經嘗試過的HTTP:// ...沒有它... ...每一個結果是同時

。 'link'無效。

任何想法?

回答

1

documentation不是特定的,但您可能無法在此上下文中指定localhost鏈接。該URL僅適用於本地計算機上的您。它不適合作爲公共網站上的鏈接。

+0

你是對的,我的例子很糟糕,所以我編輯了它。我在我們的測試服務器上遇到了同樣的問題。 – brakebg 2013-03-05 13:45:00