Facebook open graph - did not specify reference object?

倖福魔咒の 提交于 2020-01-05 07:21:47

问题


THis is a very newbie question about facebook open graph. I did the tutorial and have no problem create new namespace with new verbs and new nouns. However, I can't get a simple LIKE an OBJECT to work...

Anyway, here's the result of everything i'm doing.

I am getting the following error when I try to execute a custom built-in like with facebook's open graph:

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

Here is my code:

<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>

回答1:


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."

You are trying to post your object to like as recipe – but the parameter name has to be object instead …



来源:https://stackoverflow.com/questions/12607458/facebook-open-graph-did-not-specify-reference-object

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!