2011-10-06 63 views
0

我需要一个基本的,如何指导如何从我的网页拍照,单击按钮,该按钮操作将发送特定图像到用户墙,用一些文字...你能告诉我完成这些步骤吗?Facebook API(图表)发送网站照片墙

我已阅读Facebook的开发者论坛上,FB.ui但一切回声出:没有定义错误FB.ui事件

这里是我在HTML文件中的代码:

<div id="fb-root"></div> 
<script type="text/javascript"> 
    window.fbAsyncInit = function() { 
     FB.init({appId: 'some weird number things like that : ZCWjysg4SYlkg0gZDZD', status: true, cookie: true, xfbml: true}); 
    }; 
    (function() { 
     var e = document.createElement('script'); 
     e.type = 'text/javascript'; 
     e.src = document.location.protocol + 
      '//connect.facebook.net/en_US/all.js'; 
     e.async = true; 
     document.getElementById('fb-root').appendChild(e); 
    }()); 

和代码在JavaScript jQuery的触发按钮:

FB.ui(
    { 
    method: 'feed', 
    name: 'Facebook Dialogs', 
    link: 'http://developers.facebook.com/docs/reference/dialogs/', 
    picture: 'http://fbrell.com/f8.jpg', 
    caption: 'Reference Documentation', 
    description: 'Dialogs provide a simple, consistent interface for applications to interface with users.' 
    }, 
    function(response) { 
    if (response && response.post_id) { 
     alert('Post was published.'); 
    } else { 
     alert('Post was not published.'); 
    } 
    } 
); 

我完全不知道该怎么做......和事件在一些网站的一些代码是错误的(错误)

我觉得这里:http://developers.facebook.com/docs/reference/api/post/这是最好的信息来源知道怎么回事,但我缺少的基本步骤1. 2. 3.

回答

2

从你的代码中,APPID是错误的!应用程序ID是全部数字,特别是15位数,在某些地方它也被称为api密钥。你发布的内容看起来像应用程序的秘密,不应该把它放在JS中。
要获取应用ID,您必须在开发人员应用中创建应用,或访问this link

然后注册Javascript SDK,可以参考this url

然后调用FB.ui方法,请参阅this url
希望这会有所帮助。