FB.getLoginStatus不起作用?

FB.getLoginStatus函数由于某种原因对我不起作用 - 尽管它曾经使用了一段时间。 下面是非常基本的代码,并且警报永远不会弹出 - 看起来像FB.getLoginStatus从不调用提供的函数。 有任何想法吗 ?
<body>
<form id="form1" runat="server">
<div id="fb-root">
</div>
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
    FB.init({ appId: 'xxx', status: true, cookie: true, xfbml: true });
    FB.getLoginStatus(function (response) {
        alert("Hi there");
    });
</script>
</form>
    
已邀请:
如果您的应用程序处于沙盒模式,请参阅此错误:https://developers.facebook.com/bugs/240058389381072 另请阅读Philip Bulley的评论   [...]基本上沙盒应用程序对于非应用程序开发人员是不可见的。如果当前没有用户登录Facebook,Facebook将表现为您的沙盒应用程序根本不存在(FB显然不知道您是应用程序开发人员,因此该应用程序是不可见的!)。 此错误已得到确认和分配。     
在哪个平台上开发应用程序?如果是FBML,那么请检查FBJS-Facebook JavaScript。我认为警报在FBML应用程序中不起作用。 我得到了这个工作..只是检查
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
    FB.init({appId: 'APP_ID', status: true, cookie: true, xfbml: false});
};
(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);
}());
window.fbAsyncInit = function() {
     FB.init({appId: 'APP_ID', status: true, cookie: true, xfbml: true});

         /* All the events registered */
         FB.Event.subscribe('auth.login', function(response) {
             // do something with response
             login();
         });
         FB.Event.subscribe('auth.logout', function(response) {
             // do something with response
             logout();
         });

         FB.getLoginStatus(function(response) {
             if (response.session) {
                 // logged in and connected user, someone you know
                 login();
             }
         });
     };
    

要回复问题请先登录注册