我有parseObject“Event”,链接到另一个parseObject“CustomUser”
我发出此请求以通过EventObjectID
从Event获取自定义用户eventID = "PRmB94GHrp";
ParseQuery<ParseObject> parseQuery = ParseQuery.getQuery("Event");
parseQuery.whereEqualTo("objectId", eventID);
parseQuery.include("author");
try {
ParseObject eventParse = parseQuery.getFirst();
eventParse.pin();
eventParse.fetch();
if (eventParse.getParseObject("author") != null) { //HERE IS SOMETIMES NULL
customUserParseObject = eventParse.getParseObject("author"));
}
在行 eventParse.getParseObject(“author”)!= null ,SOMETIMES为空
如何解决?
答案 0 :(得分:0)
试试这个。
ParseQuery<ParseObject> query = ParseQuery.getQuery("Event");
query.include("author");
query.getInBackground("PRmB94GHrp", new GetCallback<ParseObject>() {
public void done(ParseObject object, ParseException e) {
if (e == null) {
ParseObject authorObject = object.getParseObject("author"));
//authorObject should contain the object
}
}
});