您好,我阅读了有关基本解析功能等的教程,我正在使用ParseUser功能。从本教程中可以看到:
ParseUser.logInInBackground("Jerry", "showmethemoney", new LogInCallback() {
public void done(ParseUser user, ParseException e) {
if (user != null) {
// Hooray! The user is logged in.
} else {
// Signup failed. Look at the ParseException to see what happened.
}
}
});我想知道我怎么才能看着ParseException看看发生了什么。例如,我想通知用户输入了错误的用户名或错误的密码。
谢谢
发布于 2013-06-07 07:05:46
如果您需要查看异常,可以尝试在日志中显示或在您决定的地方显示,在您的代码中显示日志中的Log.d(nameofalert,mensaje),只需要查看logcat中的标识您的异常
ParseUser.logInInBackground("Jerry", "showmethemoney", new LogInCallback() {
public void done(ParseUser user, ParseException e) {
if (user != null) {
Log.d("user not null",e.toString());
} else {
Log.d("error",e.toString());
// Signup failed. Look at the ParseException to see what happened.
}
}
});发布于 2015-12-20 18:57:37
解决这个问题的一个非常简单的方法是使用
e.getMessage();
// this probably shows you appropriate message
// or you can use
e.getCode();
// and match code with the integers given in Parse Doucmentation
// for example.
// e.EMAIL_NOT_FOUND is code for when email is not found in registered users class 发布于 2013-05-12 18:32:31
将您的代码放在try catch和catch块之间,尝试处理当用户输入错误的用户名或密码时将执行的操作
try{
}
catch(ParseException e)
{
// do stuff here
}https://stackoverflow.com/questions/16506433
复制相似问题