2011-11-17 63 views
8

试图打开一个对话框饲料时,我收到以下错误..当试图打开一个对话框饲料

出错获取错误。请稍后再试。

我是否需要让用户授权应用程序在墙上张贴?我认为它不会因为这不会被应用程序本身自动发布到用户的墙上。另外,我在使用我的管理员帐户时遇到错误。

这里是我的代码:

<script> 
    window.fbAsyncInit = function() { 
    FB.init({ 
    appId  : 'xxxxxxxxxxxxxxx', // App ID 
    channelURL : 'http://localhost/foods/channel.html', // Channel File 
    status  : true, // check login status 
    cookie  : true, // enable cookies to allow the server to access the session 
    oauth  : true, // enable OAuth 2.0 
    xfbml  : true // parse XFBML 
}); 

// Additional initialization code here 
    }; 

    // Load the SDK Asynchronously 
    (function(d){ 
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} 
js = d.createElement('script'); js.id = id; js.async = true; 
js.src = "//connect.facebook.net/en_US/all.js"; 
d.getElementsByTagName('head')[0].appendChild(js); 
}(document)); 


function postToFeed() { 

    // calling the API ... 
    var obj = { 
     method: 'feed', 
     link: 'https://developers.facebook.com/docs/reference/dialogs/', 
     picture: 'http://fbrell.com/f8.jpg', 
     name: 'Facebook Dialogs', 
     caption: 'Reference Documentation', 
     description: 'Using Dialogs to interact with users.' 
    }; 

    function callback(response) { 
     document.getElementById('msg').innerHTML = "Post ID: " + response['post_id']; 
    } 

    FB.ui(obj, callback); 
    } 
</script> 

<a href="javascript:void();" onclick="postToFeed();"><img src="images/share.gif" /></a> 
+0

可能重复的[重定向到认证对话框 - “出现错误,请稍后再试”](http://facebook.stackoverflow.com/questions/7231939/redirecting-to-authentication-dialog-an-error-发生,请试,再次下旬) –

回答

4

这似乎当Facebook找到你的应用程序设置和你想分享的网址之间的一些不匹配的情况发生。我在我的案例中发现它发生了,因为我的FB.init中设置了错误的应用程序ID。 AFAIK您分享的网址必须与您的应用设置中的网站网址http://developers.facebook.com/apps相对应。

请参阅this thread了解更多提示。

2

我有同样的问题。我试图在页面加载后自动打开一个Feed对话框。 10次​​中有9次显示这个错误。代码在$(document).ready jQuery函数。而且似乎有些Facebook的东西在代码执行时尚未加载。我将代码移动到$(window).load块(在加载所有页面内容后执行),并且问题已解决。

相关问题