I'm trying to add an object to a relation in Parse, although the code gets exectued without any errors the relation does not appear in the backend, therefore the object was not saved.
PFObject *newContact = [PFObject objectWithClassName:@"Contact"];
[newContact saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
PFQuery *query = [PFQuery queryWithClassName:@"Trip"];
PFObject *trip = [query getObjectWithId:self.parseID];
PFRelation *rel = [trip relationForKey:@"contacts"];
[rel addObject:newContact];
contact.parseID = newContact.objectId;
}];
I've also checked if the PFObject trip
is correct and I get back the desired object with the corresponding id. Also the key contacts
is double-checked and correct.