无法注册新的解析用户

时间:2017-02-14 07:46:01

标签: android parse-platform login

我很难注册一个新的解析用户。代码可以编译和运行。但是,没有用户在Parse上注册,并且显示的错误'注册失败'。以下是代码:

  public class MainActivity extends AppCompatActivity {
      EditText usernameField;
      EditText passwordField;
      public void signUpOrLogIn(View view){
        Log.i("AppInfo", String.valueOf(usernameField.getText()));
        Log.i("AppInfo", String.valueOf(passwordField.getText()));

      ParseUser user = new ParseUser();
      user.setUsername(String.valueOf(usernameField.getText()));
      user.setPassword(String.valueOf(passwordField.getText()));

      user.signUpInBackground(new SignUpCallback(){
    @Override
    public void done(ParseException e){
        if(e == null) {
          Log.i("AppInfo", "Signup Successful");
        }else{
          e.printStackTrace();
          Log.i("AppInfo", "Signup Unsuccessful");
        }
      }
    });
    }
      @Override
      protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);

      usernameField = (EditText) findViewById(R.id.username);
      passwordField = (EditText) findViewById(R.id.password);

    ParseAnalytics.trackAppOpenedInBackground(getIntent());
    }

我仔细检查了代码,但无法弄清楚是什么问题。 我得到的错误:

02-14 02:29:44.897 5487-5487/? I/AppInfo: username
02-14 02:29:44.897 5487-5487/? I/AppInfo: password
02-14 02:29:44.905 1335-1645/? W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client
02-14 02:30:31.723 2395-2426/? I/PlayCommon: [89] com.google.android.play.a.g.e(932): Preparing logs for uploading
02-14 02:30:31.783 2395-2426/? I/PlayCommon: [89] com.google.android.play.a.g.a(1035): Connecting to server: https://play.googleapis.com/play/log?format=raw&proto_v2=true
02-14 02:30:32.787 5487-5487/? W/System.err: com.parse.ParseRequest$ParseRequestException: bad json response
02-14 02:30:32.787 5487-5487/? W/System.err:     at com.parse.ParseRequest.newTemporaryException(ParseRequest.java:290)
02-14 02:30:32.787 5487-5487/? W/System.err:     at com.parse.ParseRESTCommand.onResponseAsync(ParseRESTCommand.java:308)
02-14 02:30:32.787 5487-5487/? W/System.err:     at com.parse.ParseRESTUserCommand.onResponseAsync(ParseRESTUserCommand.java:126)
02-14 02:30:32.787 5487-5487/? W/System.err:     at com.parse.ParseRequest$3.then(ParseRequest.java:137)
02-14 02:30:32.787 5487-5487/? W/System.err:     at com.parse.ParseRequest$3.then(ParseRequest.java:133)
02-14 02:30:32.787 5487-5487/? W/System.err:     at bolts.Task$15.run(Task.java:917)
02-14 02:30:32.787 5487-5487/? W/System.err:     at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
02-14 02:30:32.787 5487-5487/? W/System.err:     at bolts.Task.completeAfterTask(Task.java:908)
02-14 02:30:32.787 5487-5487/? W/System.err:     at bolts.Task.continueWithTask(Task.java:715)
02-14 02:30:32.787 5487-5487/? W/System.err:     at bolts.Task.continueWithTask(Task.java:726)
02-14 02:30:32.787 5487-5487/? W/System.err:     at bolts.Task$13.then(Task.java:818)
02-14 02:30:32.787 5487-5487/? W/System.err:     at bolts.Task$13.then(Task.java:806)
02-14 02:30:32.787 5487-5487/? W/System.err:     at bolts.Task$15.run(Task.java:917)
02-14 02:30:32.787 5487-5487/? W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
02-14 02:30:32.787 5487-5487/? W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
02-14 02:30:32.788 5487-5487/? W/System.err:     at java.lang.Thread.run(Thread.java:818)
02-14 02:30:32.788 5487-5487/? W/System.err: Caused by: org.json.JSONException: Value Parse.com of type java.lang.String cannot be converted to JSONObject
02-14 02:30:32.788 5487-5487/? W/System.err:     at org.json.JSON.typeMismatch(JSON.java:111)
02-14 02:30:32.788 5487-5487/? W/System.err:     at org.json.JSONObject.<init>(JSONObject.java:160)
02-14 02:30:32.788 5487-5487/? W/System.err:     at org.json.JSONObject.<init>(JSONObject.java:173)
02-14 02:30:32.788 5487-5487/? W/System.err:     at com.parse.ParseRESTCommand.onResponseAsync(ParseRESTCommand.java:298)
02-14 02:30:32.788 5487-5487/? W/System.err:    ... 14 more
02-14 02:30:32.788 5487-5487/? I/AppInfo: Signup Unsuccessful

任何解决方案?

0 个答案:

没有答案