FB.ui feed没有给出回调

我无法从我的Facebook FB.UI()方法获得任何反馈。 我确信我正确使用它,因为实际post会发布到我的墙上,但回调数据要么丢失要么是空的。 我在用:

FB.ui({ method: 'feed', name: 'asd', link: 'asd', picture: '', description: 'asd' }, function(response) { console.log(response); if(response.post_id) { $.post("ajax/wall.php",{wall : 1}); } else { } } ); 

我不确定这是如何解决的, 但它确实 🙂

我清除了我的缓存并将我的代码更改为下面并且它有效(但我不相信代码的更改实际上对它有任何影响:

 FB.ui({method: 'feed',name: '',link: '',picture: '',description: 'asd'}, function(data) { console.log(response); if(data && data.post_id) { $.post("ajax/wall.php",{wall : 1}); } else { alert("not sent"); } }); 

我有同样的问题,从来没有得到Facebook的回复function的回应。 我没有在console.log中看到任何内容或我在函数中插入的任何警报。

我的解决方案是在FB.ui的redirect_uri中放入一个URL,该URL转到带有self.close(或window.close)的HTML页面。 FB.ui弹出窗口在用户输入后重定向到那里并立即关闭。 请记住更改FB应用程序的站点URL设置,使其与文件所在的域匹配。

这是我的代码,与我的表单的提交操作相关联。 函数(响应)回调仍然存在但未使用。 如果有人看到语法错误,请评论它。

  FB.ui ({ method: 'feed', name: '', link: '', picture: '', caption: '', description: '', actions: {name:'',link:''}, redirect_uri: 'http://.../self.close.html' }, function(response) { console.log(response); if (response && response.post_id) { alert('yes'); self.close(); } else { alert('else yes'); } }); 

self.close.html中的代码行:

  

删除redirect_uri项目,将触发回调。

几分钟后我面临同样的问题,并意识到删除redirect_uri解决了它。

对于之后遇到此问题的人,我遇到了完全相同的问题,并修复如下:

 

成为

 

后视图背景div从来没有打算包含fb-root,我只是错过了一个关闭标签。

问题是我的fb-root周围的HTML格式不正确。 我只是预感到这一点,绝对有理由使用htmlvalidation器。

对于Phonegap处理此问题的任何人 – 问题在于fb connect插件。 它根本不会触发回调。

这是来自FacebookConnectPlugin.m的代码片段:

 //////////////////////////////////////////////////////////////////// // FBDialogDelegate /** * Called when the dialog succeeds and is about to be dismissed. */ - (void)dialogDidComplete:(FBDialog *)dialog { // TODO } /** * Called when the dialog succeeds with a returning url. */ - (void)dialogCompleteWithUrl:(NSURL *)url { // TODO } /** * Called when the dialog get canceled by the user. */ - (void)dialogDidNotCompleteWithUrl:(NSURL *)url { // TODO } /** * Called when the dialog is cancelled and is about to be dismissed. */ - (void)dialogDidNotComplete:(FBDialog *)dialog { // TODO } 

我不是Objective C程序员,所以我不是要解决这个问题,可能要等到插件完成…

设置redirect_uri会禁用回调

Interesting Posts