简体   繁体   English

Facebook开放图 - 没有指定参考对象?

[英]Facebook open graph - did not specify reference object?

THis is a very newbie question about facebook open graph. 这是关于facebook开放图的一个非常新手的问题。 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: 当我尝试执行与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

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>

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." 消息:“您尝试发布的操作无效,因为它未指定任何引用对象。必须至少指定以下属性之一:object。”

You are trying to post your object to like as recipe – but the parameter name has to be object instead … 您试图将您的对象发布为喜欢的recipe - 但参数名称必须是object而不是...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM