尝试在Parse for Android中创建新用户时出错

时间:2015-08-09 23:05:28

标签: android parse-platform

当我尝试注册新用户时,我收到错误

No supported account linking service found

这是我的注册方法

`public void createUser(View view){         String username = usernameEditText.getText()。toString()。trim();         String password = passwordEditText.getText()。toString()。trim();

    // Set up a progress dialog
    final ProgressDialog dialog = new ProgressDialog(SignupActivity.this);
    dialog.setMessage(getString(R.string.progress_signup));
    dialog.show();

    // Set up a new Parse user
    ParseUser user = new ParseUser();
    user.setUsername(username);
    user.setPassword(password);

    // Call the Parse signup method
    user.signUpInBackground(new SignUpCallback() {
        @Override
        public void done(ParseException e) {
            dialog.dismiss();
            if (e != null) {
                // Show the error message
                Toast.makeText(SignupActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
            } else {
                // Start an intent for the dispatch activity
                //Intent intent = new Intent(SignupActivity.this, DispatchActivity.class);
                //intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
                Toast.makeText(SignupActivity.this, "You signed up!", Toast.LENGTH_LONG).show();
                //startActivity(intent);
            }
        }
    });

}`

这是我的申请:

public class ParseApplication extends Application {
  @Override
  public void onCreate() {
    super.onCreate();


    // Initialize Crash Reporting.
    ParseCrashReporting.enable(this);

    // Enable Local Datastore.
    Parse.enableLocalDatastore(this);

    // Add your initialization code here
    Parse.initialize(this, "O4oL0sDxJz6tWKT7JqKJ7iaQ46kU356oMCWzLCkv", "QktMk3l5KKFYv1nna0dnYzmnHxHzeyqIaCOKVSod");


    ParseUser.enableAutomaticUser();
    ParseACL defaultACL = new ParseACL();
    // Optionally enable public read access.
    // defaultACL.setPublicReadAccess(true);
    ParseACL.setDefaultACL(defaultACL, true);
  }
}

我不想与任何东西联系,我只想保存一个ParseUser。我做错了什么?

1 个答案:

答案 0 :(得分:1)

首先检查自动用户是否已登录(或其他任何人):

  //Check if anyone is signed in
        ParseUser currentUser = ParseUser.getCurrentUser();
        if (currentUser != null) {
            //Logged in, do something
        } else {
            //No user, create one
        }

此外:

ParseUser.enableAutomaticUser();  //Will make app bug out 

这就是为什么,当您启动应用程序时,它认为已经有用户登录。干杯