[英]I am trying to enter data to a custmom column in parse.com ,but I am getting an error
I have made a user table that looks as which includes a custom Name field . 我制作了一个用户表,该表看起来包含一个自定义“名称”字段。
Now whenever I try to put data into this field i get an error . 现在,每当我尝试将数据放入此字段时,都会出现错误。
The code i Used was . 我使用的代码是。
ParseUser user = new ParseUser();
user.setUsername(Name);
user.setPassword(Password);
user.setEmail("nevin.george.sunny@gmail.com");
user.put("Name","test");
user.signUpInBackground(new SignUpCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
// Show a simple Toast message upon successful registration
Toast.makeText(getApplicationContext(),
"Successfully Signed up, please log in.",
Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(),
"Sign up Error", Toast.LENGTH_LONG)
.show();
}
}
});
But I get the "Sign Up error" Message Displayed .And no updates in the table . 但是我收到显示的“注册错误”消息。表中没有更新。
The Code below has worked for me on numerous projects (so thought I would paste in case it helped). 下面的代码在许多项目上为我工作(所以我认为如果有帮助,我会粘贴)。 Where are you getting your 'setusername' and 'setpassword' from?
您从哪里获得“ setusername”和“ setpassword”?
public void register(final View v){
if(mUsernameField.getText().length() == 0 || mPasswordField.getText().length() == 0)
return;
v.setEnabled(false);
ParseUser user = new ParseUser();
user.setUsername(mUsernameField.getText().toString());
user.setPassword(mPasswordField.getText().toString());
//mErrorField.setText("");
user.signUpInBackground(new SignUpCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
Intent intent = new Intent(RegisterActivity.this, LoggedIn.class);
startActivity(intent);
finish();
} else {
// Sign up didn't succeed. Look at the ParseException
// to figure out what went wrong
switch(e.getCode()){
case ParseException.USERNAME_TAKEN:
mErrorField.setText("Sorry, this username has already been taken.");
break;
case ParseException.USERNAME_MISSING:
mErrorField.setText("Sorry, you must supply a username to register.");
break;
case ParseException.PASSWORD_MISSING:
mErrorField.setText("Sorry, you must supply a password to register.");
break;
default:
mErrorField.setText(e.getLocalizedMessage());
}
v.setEnabled(true);
}
}
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.