Facebook登录后,ParseUser saveInBackground仍未保存

时间:2014-06-21 06:30:28

标签: java android facebook parse-platform

我已登录facebook,并使用ParseFacebookUtil登录Parse。我可以获得当前用户,并将我的“高分”加入其中。但是,当我执行saveInBackground时,它的错误状态为“在注册之前无法保存ParseUser”。

    if (ParseUser.getCurrentUser() != null) {
        ParseUser.getCurrentUser().put("highscore", getHighScore());
        ParseUser.getCurrentUser().saveInBackground(new SaveCallback() {
              public void done(ParseException e) {
                     if (e == null) {
                         Log.d(TAG, "SAVE SUCCESSFUL");   

                     } else {
                         Log.d(TAG, "SAVE FAILED " + e.getCause());   
                     }
                   }
                 });

    }

我的ParseFacebookUtil登录代码如下

ParseFacebookUtils.logIn(fbUser.getId(), session.getAccessToken(), 
    session.getExpirationDate(), new LogInCallback() {
    @Override
    public void done(ParseUser parseUser, ParseException err) {                   
        if (parseUser != null) {
            // The user has been saved to Parse.
            if (parseUser.isNew()) {
                // This user was created during this session with Facebook Login.                       
                Log.d(TAG, "ParseUser created.");

                // Call saveInventory() which will save data to Parse if connected. 
                CarRunnerApplication app = ((CarRunnerApplication)getApplication());
                app.saveInventory();
            } else {
                Log.d(TAG, "User exists in Parse. Pull their values: " + parseUser);

                // This user existed before. Call loadInventory() which has logic
                // to check Parse if connected.
                CarRunnerApplication app = ((CarRunnerApplication)getApplication());
                app.loadInventory();
            }

            loadInventoryFragment();
        } else {
            // The user wasn't saved. Check the exception.
            Log.d(TAG, "User was not saved to Parse: " + err.getMessage());
        }
    }
});

过去曾经有过工作,但我不知道什么时候它不再有用了。有人可以解释如何调试它...谢谢。

0 个答案:

没有答案