2012-08-24 57 views
-1

我曾試圖按照Facebook的樣品教程:developers.facebook.com/docs/opengraph/tutorial/#debug創建Facebook應用程序無法正常工作

但之後,我做它,點擊煮飯鍵,它是顯示「發生錯誤」。

這裏你可以看到應用程序: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> 

而且,這裏是從應用程序的基本設置截圖:

請告訴我什麼是錯的..

感謝提前:)

+0

將'response'的值記錄到瀏覽器的控制檯,看看它說了什麼。 – CBroe

+0

我該怎麼做? – lolzishhere

回答

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

&應該是

+0

還出現同樣的錯誤:( – lolzishhere

+0

感謝您的幫助..我已經通過更改api將其修復爲:--- FB.api( '/ me/abcrecipelist:cook', 'post', {配方:'http://www.akashbc.com/facebookapp/index.html'}, 函數(響應)如果(!response || response.error){ alert('Error occured'); }其他{ alert('Cook was successful!Action ID:'+ response.id); } }); – lolzishhere

相關問題