Search code examples
iosparse-platformlocal-datastore

Parse saveEventually saves empty object


When I'm trying to save a PFObject without network connection it is successfully saved locally, whenever I start the app again with network connection, it seems that the object is going to be saved to the server, but all parameters are empty.

I'm doing the following procedure, first I create a PFObject with different values and call saveEventually. During these steps I do not have an internet connection (airplane mode is on), therefore it can't be saved to the server and was saved locally.

PFObject *contact = [PFObject objectWithClassName:@"Contact"];
[contact setObject:[PFUser currentUser] forKey:kRelatedToUserKey];
[contact setObject:self.firstname forKey:kFirstnameKey];
[contact setObject:self.lastname forKey:kLastnameKey];

[contact saveEventually];

Now, I'm closing the app and start it again, I'm loading my contacts like that. I'm getting back the correct object with all the correct value for firstname, lastname, etc.

PFQuery *postQuery = [PFQuery queryWithClassName:@"Contact"];
[postQuery whereKey:@"related_to_user" equalTo:[PFUser currentUser]];
[postQuery fromLocalDatastore];
[postQuery findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
    if (!error) {
        // here I get back the correct object from local storage, with all values
    }
}];

Now, when I'm switching airplane mode off, it tries to save the object to the server, but all I can see in the backend is an objectId without any values.

enter image description here

Whereas the locally saved object has all the correct values.


Solution

  • This bug is now fixed in Parse version 1.6.3!