I have a block of code in an Android project that creates a ParseObject
and stores it in the local datastore. However, when I go to check the objectId in the done()
callback method of pinInBackground()
it returns null. If I switch from pinInBackground()
to saveInBackground()
then it works fine and a valid objectId is given. Here is the code:
final ParseObject testObject = new ParseObject("TestObject");
testObject.put("foo", "bar2");
testObject.pinInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if (e != null) {
Log.e(TAG, "Failed to pin TestObject: " + e.getMessage());
return;
}
Log.d(TAG, "Added key-value pair to TestObject '" + testObject.getObjectId() + "': 'foo' => 'bar2'");
}
});
The log shows:
Added key-value pair to TestObject 'null': 'foo' => 'bar2'
Why is the objectId null? Do I need to set it since it's not saving to the cloud?