0

其次确切的指示按?代码如下:无法发布样品的Open Graph按照指令

======================================== ========================

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

<head prefix="og: http://ogp.me/ns# test_app: 
http://ogp.me/ns/apps/test_app#"> 
<meta property="fb:app_id" content="129xxxxxxxxxxxx" /> 
<meta property="og:type" content="test_app:recipe" /> 
<meta property="og:title" content="Stuffed Cookies" /> 
<meta property="og:image" content="http://x.example.com/cookedrcp.jpg" /> 
<meta property="og:description" content="The Turducken of Cookies" /> 
<meta property="og:url" content="http://apps.facebook.com/test_app/index.php"> 

<script type="text/javascript"> 
function postCook() 
{ 
    FB.api('/me/test_app:cook' + 
       '?recipe=http://apps.facebook.com/test_app/index.php','post', 
       function(response) { 
     if (!response || response.error) { 
       alert('Error occured'); 
     } else { 
      alert('Post was successful! Action ID: ' + response.id); 
      } 
    }); 
} 
</script> 
</head> 

<body> 
<div id="fb-root"></div> 
<script src="http://connect.facebook.net/en_US/all.js"></script> 
<script> 
    FB.init({ 
     appId:'129xxxxxxxxxxxx', cookie:true, 
     status:true, xfbml:true, oauth:true 
    }); 
    </script> 

    <fb:add-to-timeline></fb:add-to-timeline> 

    <h3> 
     <font size="30" face="verdana" color="grey"> 
      Stuffed Cookies 
     </font> 
    </h3> 
    <p> 
     <img title="Stuffed Cookies" 
         src="http://x.example.com/cookedrcp.jpg" 
         width="550"/><br /> 
    </p>  

    <form> 
     <input type="button" value="Cook" onclick="postCook()" /> 
    </form> 
</body> 
</html> 

=================== ==================================================

我已经创建了开放式图形作为样品每页面如烹饪食谱。

任何帮助将不胜感激。

+0

你会得到任何JavaScript错误?您是否尝试过使用[Facebook调试器工具](https://developers.facebook.com/tools/debug)查看Facebook如何查看您的网址? – Lix 2012-01-05 17:15:13

+0

你的'response.error'是什么? – 2012-01-05 18:38:27

回答

0

我有一种感觉,你没有得到用户的有效的access_token。在文档(https://developers.facebook.com/docs/beta/opengraph/tutorial/#publish)中,它表示您的用户需要已经通过了应用程序的身份验证。在调用FB.api()之前,确保当前用户通过调用FB.getLoginStatus()进行验证。