我正面临与parse.com相关的一些问题 我想获取一个特定对象的数据...我已经使用下面的代码来获取数据,但似乎它已被折旧......它在异常后返回
no results found for query
我使用以下代码从objectId获取数据:
ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("User");
query.getInBackground("U8mCwTHOaC", new GetCallback() {
public void done(ParseObject object, ParseException e) {
Log.d(">>>", "0000>>>" +objid);
dlg.dismiss();
if (e == null) {
// object will be your game score
Log.d(">>",">>"+object);
} else {
// something went wrong
Log.d(">>",">>"+e);
}
}
});
这里&#34; U8mCwTHOaC&#34;是我的objectId,我想提前获取此objectId.Thanks的行..
答案 0 :(得分:6)
如果你想从用户表中获取数据。
ParseQuery<ParseObject> query = ParseQuery.getQuery("_User");
query.whereEqualTo("objectId","U8mCwTHOaC");
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> objects, ParseException e) {
if (e == null) {
// row of Object Id "U8mCwTHOaC"
} else {
// error
}
}
});
如果您想要当前用户的行
ParseQuery<ParseObject> query = ParseQuery.getQuery("_User");
query.whereEqualTo("objectId",ParseUser.getCurrentUser().getObjectId());
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> objects, ParseException e) {
if (e == null) {
// row of Object Id "Current USer"
} else {
// error
}
}
});