创建Facebook应用程序不起作用

时间:2012-08-24 07:47:30

标签: facebook facebook-javascript-sdk

我试图按照facebook的示例教程:developers.facebook.com/docs/opengraph/tutorial/#debug

但是在我点击并点击“烹饪”按钮后,它显示“错误发生”。

您可以在此处查看该应用:http://www.akashbc.com/facebookapp/index.html

以下是该应用的页面来源:

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"> 

<head prefix="og: http://ogp.me/ns# og_recipebox: http://ogp.me/ns/apps/abcrecipelist#"> 
    <meta property="fb:app_id" content="258611890922127" /> 
    <meta property="og:type" content="abcrecipelist:recipe" /> 
    <meta property="og:title" content="Oreo Stuffed Cookies" /> 
    <meta property="og:image" content="http://1.bp.blogspot.com/-92sA7pC51pg/T9CKdHHeDzI/AAAAAAAACbg/MRq4PR2P5QQ/s1600/jQuery_Cookies.jpg" /> 
    <meta property="og:description" content="The Turducken of Cookies" /> 
    <meta property="og:url" content="http://www.akashbc.com/facebookapp/index.html"> 

    <script type="text/javascript">
    function postCook()
    {
        FB.api('/me/abcrecipelist:cook&recipe=http://www.akashbc.com/facebookapp/index.html','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:'258611890922127', 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="Oreo Stuffed Cookies" src="http://1.bp.blogspot.com/-92sA7pC51pg/T9CKdHHeDzI/AAAAAAAACbg/MRq4PR2P5QQ/s1600/jQuery_Cookies.jpg" width="550"/><br />
        </p>       

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

        <fb:activity actions="YOUR_NAMESPACE:cook"></fb:activity>
    </body> 
</html>

此处还有应用程序基本设置的屏幕截图:

请告诉我哪里错了..

提前致谢:)

1 个答案:

答案 0 :(得分:0)

您的API调用不正确:

FB.api('/me/abcrecipelist:cook&recipe=http://www.akashbc.com/facebookapp/index.html' ...

应该是

FB.api('/me/abcrecipelist:cook?recipe=http://www.akashbc.com/facebookapp/index.html' ...

即。 &amp; 应该是