If two separate users have the same PFObject locally and user1 saves the object first then user2 calls to save it next(like below), will the array only contain user2 objectId or both objectIds?
[object addUniqueObject:[[PFUser currentUser]objectId] forKey:@"invite"];
[object saveInBackground];
And if it only contains user2id is the only way to make sure the object saves properly is to fetch it right before I save it?
According to the Parse API docs,
addUniqueObjectis an atomic operation, so similarly toincrement, it should still work in a race condition (i.e. if either of the objects being saved hasn't been fetched).You shouldn't have to fetch both objects for it to save properly. If it's not working, it might be because you're overriding it somewhere else (like in cloud code), but the
addUniqueObjectcall should allow both objects to save