我现在正尝试将Parse用于Android应用,并且在完成保存到服务器之后我想要使用ParseObject
做一些事情。回调应该是调用done(ParseObject, ParseException)
,但由于某种原因,它会进入done(Object, Throwable)
方法。有什么线索的原因?
ParseObject event = new ParseObject("Event");
event.saveInBackground(new SaveCallback() {
@Override
public void done(ParseObject parseObject, ParseException e) {
if (e == null) {
// code in here should be executing
}
}
@Override
public void done(Object o, Throwable throwable) {
// but instead, code in here is actually executing
}
}
答案 0 :(得分:0)
SaveCallback
不会返回ParseObject
。只有在Exception
parse.com
ParseObject event = new ParseObject("Event");
event.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException arg0) {
// TODO Auto-generated method stub
}
});
答案 1 :(得分:0)
尝试这种方式。
ParseObject event = new ParseObject("Event");
event.put("hear Class Field name", "hear new value from user input");
// before u want to save in background set user psermission for read &
// write like this way
ParseACL postACL = new ParseACL(ParseUser.getCurrentUser());
postACL.setPublicReadAccess(true);
postACL.setPublicWriteAccess(true);
event.setACL(postACL);
event.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
// TODO Auto-generated method stub
if (e == null) {
// hear u will get success message
} else {
// and hear u will get fail message
// also get which error throw like
Log.e("testing ", "get error code " + e.getCode()
+ " get Error Message " + e.getMessage());
}
}
});