I'm trying to get an Object with a Parse query.
This is my code :
ParseQuery<ParseObject> query = ParseQuery.getQuery("Conference");
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> results, ParseException e) {
if (e == null) {
// Results were successfully found from the local datastore.
} else {
showLog(e.toString());
}
}
});
I get this error:
com.parse.ParseException: java.lang.IllegalStateException: ParseObject has no data for 'objectId'. Call fetchIfNeeded() to get the data.
BTW my Conference
Class contains Pointers.
If you're querying directly from Parse, you can do:
ParseQuery<ParseObject> query = ParseQuery.getQuery("Conference");
...
query.include("name_of_the_column_containing_a_pointer");
query.include("another_pointer_column");
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> results, ParseException e) {
if (e == null) {
// You can now access the pointers specified in the include
} else {
showLog(e.toString());
}
}
});
Otherwise, if you're querying the local datastore:
ParseQuery<ParseObject> query = ParseQuery.getQuery("Conference");
...
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> results, ParseException e) {
if (e == null) {
ParseObject parseObject = results.get(0); // Get the object
parseObject.fetchIfNeededInBackground(new GetCallback<ParseObject>() {
public void done(ParseObject result, ParseException e) {
if (e == null)
// Do something with result
}
}
} else {
showLog(e.toString());
}
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With