0

所以我有一个应用程序目前正在使用facebook api从facebook获取用户信息。该应用程序一直在100%工作,直到今天突然,某些信息不会加载。我将它追溯到Facebook当前用户的请求。这是请求的日志:Facebook API用户请求graphObject为空

{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[{}]} 

图形对象为null,并且从不调用onCompleted方法。正如我之前所说的,到目前为止,这一直很有成效,我根本没有触及过这门课。整个请求在下面,任何帮助非常感谢!

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)); 

回答

0

使用此库处理Facebook API。因为它是真棒!真的!..

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

阅读文档,享受图书馆。

告诉我,如果有帮助

+0

看起来很酷,我会给它一个镜头。 – 2015-02-24 20:22:19

+0

所以接受答案,尽管它会帮助其他人找到正确的答案。 :) – theapache64 2015-02-24 20:24:16

+0

那么让我先实施它。它看起来更容易,但我认为我仍然屈从于同样的错误。考虑到我原来的解决方案几周来一直工作正常,我认为在连接上有点怪异。虽然这个库def比较容易! – 2015-02-24 20:27:51

相关问题