[英]How to get if a code exist in parse.com?
我有一个问题,我在parse.com中的“ VerificationCode”数据库中具有以下结构:
当有人在我的应用程序中插入代码时,它会自动在“ attachedUser”列中添加本地存储的用户ID,我将其称为“ ParseInstallObject.codigo2”,例如,我获得该用户的ID以在其中查看文本视图等
问题是我想检查用户ID是否存在于解析中。 如果存在,则执行某项操作;如果不存在,则执行另一项操作。
我使用了在parse.com文档中看到的代码,但它始终表明该代码存在。 这是我的代码:
ParseQuery<ParseObject> query2 = ParseQuery.getQuery("VerificationCode");
query2.whereEqualTo("attachedUser", ParseInstallObject.codigo2);
query2.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> scoreList, ParseException e) {
if (e == null) {
comprobar.setText("exist");
comprobar2.setText("exist");
} else {
comprobar.setText("no exist");
comprobar2.setText("no exist");
}
}
});
如何查看用户是否具有有效的密码?
e==null means that the call was successfully completed by the server. It does not imply that the user exists or not.
if(e==null){
if(scoreList == null || scoreList.isEmpty()){
// The user does not exist.
}else{
// the user exists.
}
}else {
// You have an exception (like HTTPTimeout, etc). Handle it as per requirement.
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.