Facebook FB.ui apprequest没有在手机上显示

时间:2012-04-10 08:51:53

标签: facebook jquery-mobile facebook-javascript-sdk fb.ui

我正在开发一个与facebook集成的移动应用程序。该应用程序是使用jquery mobile开发的(见下文)

<link rel="stylesheet" <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>

到目前为止,我已经设法将Facebook功能与Facebook JSSDK以及普通浏览器集成,因为它应该(登录,注销,其他api调用),但是当我尝试发送apprequest时:

function sendRequest() {
    FB.ui({ method: 'apprequests', message: 'Are you ready?',
    }, function(response) {
    console.log('sendRequest response: ', response);
    if (response && response.to) {
      for (var j = 0; j < response.to.length; j++) {
    alert('You have: ' + response.response.name + ' with User id: ' + response.to[j] + ' invited');
        //alert(response.to[j]);
      }
    } else {
            console.log('User didn't invite anyone');       
        }
});

在移动设备上,请求对话框不会弹出。我只看到一个空白的白色屏幕。 有谁知道我做错了什么?

1 个答案:

答案 0 :(得分:0)

在尝试了几件事之后,似乎问题在于移动设备的页面高度以及对话框在屏幕上的位置。

我使用以下内容来修复我的nexus5:

添加了一个页面:

<div data-role="page" id="fb-page">
    <div id="fb-root"></div>
</div>

CSS:

#fb-page {
    position: initial;
}