Facebook的API用户请求graphObject为null [英] Facebook API User Request graphObject is null

查看:184
本文介绍了Facebook的API用户请求graphObject为null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我当前正在使用Facebook的API来获取来自Facebook用户的一个信息的应用程序。这个应用程序已经工作100%,直到今天的时候,突然,某些信息难道不加载。我跟踪它回到Facebook的我要求福尔进入从当前用户。这是请求的日志:

  {要求:会话:{会话状态:打开,令牌:{的accessToken令牌:ACCESS_TOKEN_REMOVED权限:[user_birthday,basic_info]},APPID:349620835240734},graphPath:我graphObject:空,列举HTTPMethod:GET,参数:捆绑[{}]}

图形对象为null,并且onCompleted方法不会被调用。正如我前面所说的,这已经被伟大的工作,到现在为止,我还没有触及这个类的。整个请求低于,任何帮助是极大的AP preciated!

 请求请求= Request.newMeRequest(mSession,新Request.GraphUserCallback(){
                @覆盖
                公共无效onCompleted(GraphUser用户,响应响应){
                    //如果响应是成功的
                    如果(mSession == Session.getActiveSession()){
                        如果(用户!= NULL){
                            串currentUserId = user.getId();
                            字符串名称= user.getFirstName();
                            字符串的生日= user.getBirthday();
                            串年龄= getAge(生日);
                            字符串性别= user.asMap()获得(Constants.GENDER)的ToString()。                            mParseUser.put(Constants.NAME,名);
                            mParseUser.put(Constants.AGE,年龄);
                            mParseUser.put(Constants.GENDER,性别);
                            mParseUser.saveInBackground();                            共享preferences preF =
                                    mContext.getShared preferences(ParseUser.getCurrentUser()。getUsername()
                                            Context.MODE_PRIVATE);
                            共享preferences.Editor ED = pref.edit();
                            ed.putString(Constants.FACEBOOK_USER_ID,currentUserId);
                            ed.apply();
                        }
                    }
                }
            });
            Request.executeBatchAsync(请求);
            Log.e(RequestValue,将String.valueOf(要求));


解决方案

在处理与Facebook API.because是真棒使用这个库!真的!..

https://github.com/sromku/android-simple-facebook

阅读文档,享受图书馆。

告诉我,如果它有助于

So I have an application that is currently using the facebook api to get a users info from facebook. The application has been working 100% until today when suddenly, certain info wouldnt load. I traced it back to the Facebook me request foor getting into from the current user. This is the Log of the request:

{Request:  session: {Session state:OPENED, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[user_birthday, basic_info]}, appId:349620835240734}, graphPath: me, graphObject: null, httpMethod: GET, parameters: Bundle[{}]}

The graph object is null and the onCompleted method is never called. As I stated before, this has been working great up until now and I have not touched this class at all. The entire request is below, and any help is GREATLY appreciated!

Request request = Request.newMeRequest(mSession, new  Request.GraphUserCallback() {
                @Override
                public void onCompleted(GraphUser user, Response response) {
                    // If the response is successful
                    if (mSession == Session.getActiveSession()) {
                        if (user != null) {
                            String currentUserId = user.getId();
                            String name = user.getFirstName();
                            String birthday = user.getBirthday();
                            String age = getAge(birthday);
                            String gender = user.asMap().get(Constants.GENDER).toString();

                            mParseUser.put(Constants.NAME, name);
                            mParseUser.put(Constants.AGE, age);
                            mParseUser.put(Constants.GENDER, gender);
                            mParseUser.saveInBackground();

                            SharedPreferences pref =
                                    mContext.getSharedPreferences(ParseUser.getCurrentUser().getUsername(),
                                            Context.MODE_PRIVATE);
                            SharedPreferences.Editor ed = pref.edit();
                            ed.putString(Constants.FACEBOOK_USER_ID, currentUserId);
                            ed.apply();
                        }
                    }
                }
            });
            Request.executeBatchAsync(request);
            Log.e("RequestValue", String.valueOf(request));

解决方案

Use this library when you deal with Facebook API.because it is AWESOME!! Really!..

https://github.com/sromku/android-simple-facebook

Read the docs and enjoy the library.

Tell me if it helps

这篇关于Facebook的API用户请求graphObject为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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