小编use*_*251的帖子

Facebook登录没有响应FB.login响应

我正在使用facebook集成的android phonegap应用程序.的FB.login(函数(响应)函数有一个响应处理它被称为FB上的按钮,当用户点击,但它不进入功能响应或警报("测试")每次.它时才进入这个剧本我点击大约5或6次.我需要的是在我第一次登录Facebook时获取访问令牌.我已经经历了很多关于此的链接但是无法找到一个确切的解决方案...

如果用户已登录facebook,则FB登录回调函数无响应

即使这个问题似乎是相同的,但我无法弄清楚我的解决方案.

这是我工作的代码:

<div id="data">Hello Facebooktesters, loading ...</div>

<button onclick="login()">Login</button>
<button onclick="me()">Me</button>
<button onclick="logout()">Logout</button>
<button onclick="Post()">facebookWallPost</button>

<script type="text/javascript">
    document.addEventListener('deviceready', function() {
        try {
            alert('Device is ready! Make sure you set your app_id below this alert.');
            FB.init({
                appId : "xxxxxxxxxxxxxxx",
                nativeInterface : CDV.FB,
                useCachedDialogs : false
            });
            document.getElementById('data').innerHTML = "FB init executed";
        } catch (e) {
            alert(e);
        }
    }, false);

    function me() {
        FB.api('/me/friends', {
            fields : 'id, name, picture'
        }, function(response) {
            if (response.error) {
                alert(JSON.stringify(response.error));
            } else …
Run Code Online (Sandbox Code Playgroud)

facebook

5
推荐指数
1
解决办法
3726
查看次数

标签 统计

facebook ×1