Facebook打开图 - 没有指定参考对象? [英] Facebook open graph - did not specify reference object?

查看:80
本文介绍了Facebook打开图 - 没有指定参考对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个关于Facebook开放图表的新手问题。我做了教程,没有问题用新的动词和新的名词创建新的命名空间。但是,我无法得到一个简单的LIKE一个OBJECT工作...

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.

当我尝试像Facebook的开放图表一样执行自定义内置时,我收到以下错误:

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

这是我的代码:

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


推荐答案


消息:您尝试发布的操作无效,因为它不指定任何引用对象。必须至少指定以下属性之一:object。

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 …

这篇关于Facebook打开图 - 没有指定参考对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆