使用Parse在Android中注册用户的登录失败错误

时间:2014-03-03 18:43:34

标签: android login parse-platform

我已经使用parse.com的Parse注册流程注册了用户。

ParseUser user = new ParseUser();
    user.setUsername(mEtUname.getText().toString());
    user.setPassword(mEtPwd.getText().toString());
    user.setEmail(mEtEmail.getText().toString());

    // other fields can be set just like with ParseObject
    user.put("phone", "xxxxxxxxxx");

    user.signUpInBackground(new SignUpCallback() {

    @Override
    public void done(com.parse.ParseException e) {
        // TODO Auto-generated method stub
        if (e == null) {
              // Hooray! Let them use the app now.
            Log.d("Testing", "registration  successful ");
            Toast.makeText(RegistrationScreen.this, "I am registered", Toast.LENGTH_LONG).show();
            } else {
              // Sign up didn't succeed. Look at the ParseException
              // to figure out what went wrong
                Log.d("Testing", "registration not successful "+e.getMessage());
            }
    }
    });
}

注册后,用户将在Parse网站上的浏览器上的解析用户列表中显示。现在我尝试使用以下代码登录用户:

ParseUser.logInInBackground(username, pwd, new LogInCallback() {

        @Override
        public void done(ParseUser user, ParseException e) {
            // TODO Auto-generated method stub
            if (user != null) {
                Log.d("Testing", "I am logged in");
            } else {
                // Signup failed. Look at the ParseException to see what
                // happened.
                switch (e.getCode()) {
                case ParseException.USERNAME_TAKEN:
                    Log.d("Testing","Sorry, this username has already been taken.");
                    break;
                case ParseException.USERNAME_MISSING:
                    Log.d("Testing","Sorry, you must supply a username to register.");
                    break;
                case ParseException.PASSWORD_MISSING:
                    Log.d("Testing","Sorry, you must supply a password to register.");
                    break;
                case ParseException.OBJECT_NOT_FOUND:
                    Log.d("Testing","Sorry, those credentials were invalid.");
                    break;
                case ParseException.CONNECTION_FAILED:
                    Log.d("Testing","Internet connection was not found. Please see your connection settings.");
                    break;
                default:
                    Log.d("Testing",e.getLocalizedMessage());
                    break;
                }

但每次它都说“抱歉。登录失败的无效登录凭据”。我已经检查过首先注销用户然后登录。但结果是一样的。

任何人都可以帮忙。

谢谢,Arindam

0 个答案:

没有答案