2012-09-26 42 views
1

這是一個關於facebook開放圖的非常新手問題。我做了這個教程,沒有任何問題用新的動詞和新名詞創建新的命名空間。然而,我不能得到一個簡單的對象來工作...Facebook的開放圖 - 沒有指定參考對象?

無論如何,這是我所做的一切的結果。

我收到以下錯誤,當我嘗試執行內置像Facebook的開放圖譜定製:

Object 
error: Object 
code: 1611072 
message: "The action you're trying to publish is invalid because it does not specify any reference objects. At least one of the following properties must be specified: object." 
type: "Exception" 
__proto__: Object 
__proto__: Object 

這裏是我的代碼:

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" 
     xmlns:fb="https://www.facebook.com/2008/fbml"> 
<head> 
    <title>OG Tutorial App</title> 

<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object#"> 
    <meta property="fb:app_id" content="99999999999" /> 
    <meta property="og:type" content="object" /> 
    <meta property="og:url" content="http://jl.com/" /> 
    <meta property="og:title" content="Sample Object" /> 
    <meta property="og:image" content="https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png" /> 

</head> 
<body> 
    <div id="fb-root"></div> 
    <script type="text/javascript"> 
    function postbake() 
    { 
     FB.api(
     '/me/og.likes', 
     'post', 
     { recipe: 'http://jl.com/' }, 
     function(response) { 
      if (!response || response.error) { 
       alert('Error occured'); 
       console.log(response); 
      } else { 
       alert('bake was successful! Action ID: ' + response.id); 
      } 
     }); 
    } 
    </script> 

    <script> 
    window.fbAsyncInit = function() { 
     FB.init({ 
     appId  : '999999999999', // App ID 
     status  : true, // check login status 
     cookie  : true, // enable cookies to allow the server to access the session 
     xfbml  : true // parse XFBML 
     }); 
    }; 

    // Load the SDK Asynchronously 
    (function(d){ 
     var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} 
     js = d.createElement('script'); js.id = id; js.async = true; 
     js.src = "//connect.facebook.net/en_US/all.js"; 
     d.getElementsByTagName('head')[0].appendChild(js); 
    }(document)); 
    </script> 

    <fb:login-button show-faces="true" width="200" max-rows="1" scope="publish_actions"> 
    </fb:login-button> 

    <input type="button" onclick="postbake()" value="like it" /> 
</body> 
</html> 

回答

4

消息:「您嘗試發佈的操作無效,因爲它沒有指定任何引用對象。必須至少指定以下屬性之一:object。「

您嘗試後你的對象喜歡爲recipe - 但是參數名稱必須object,而不是...