Request.GraphUserCallback总是返回空用户 [英] Request.GraphUserCallback always return a null user

查看:202
本文介绍了Request.GraphUserCallback总是返回空用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Android和Facebook SDK新。
我跟着从Facebook开发者页面LoginButton教程。万物工作顺利,直到我试图获取用户信息。
我搜索了每一个论坛的解决方案,但没有发现这解决了我的问题的解决方案。
这里是我的code:

I'm new on android and facebook SDK. I followed the LoginButton tutorial from facebook developers pages. Everythings worked well until I tried to get user info. I searched a solution on every forum but didn't find a solution which solved my problem. Here is my code:

private void onSessionStateChange(Session session, SessionState state, Exception exception) {
    if (state.isOpened()) {
        Log.i(TAG, "Logged in...");

        // make request to the /me API
        Request.newMeRequest(session, new Request.GraphUserCallback() {

            // callback after Graph API response with user object
            @Override
            public void onCompleted(GraphUser user, Response response) {
                if (user != null) {
                    welcome.setText("Hello " + user.getName() + "!");
                }
            }
        }).executeAsync();

    } else if (state.isClosed()) {
        Log.i(TAG, "Logged out...");
    }
}

我登录,我接受了Facebook的权限和我在清单中声明INTERNET权限,但我的'用户'始终为空。

I'm logged in, I accepted facebook permissions and I declared INTERNET permission in my manifest but my 'user' is always null.

任何想法?

推荐答案

我的坏...
在我的清单我的上网权限是应用程序的孩子,而不是明显...
我看到,当我试图打造专业化的APK,从来没有当我在调试模式。

My bad... My internet permission in my manifest was a child of "application" instead of "manifest"... I saw that when I tried to buid the apk, never when I was on debug mode.

对不起,愚蠢的问题,也许它可以帮助反正其他一些新手和我一样。 ;)

Sorry for the stupid question, maybe it can helps anyway some others newbies like me. ;)

这篇关于Request.GraphUserCallback总是返回空用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆