Reputation: 1071
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 user2
id is the only way to make sure the object saves properly is to fetch it right before I save it?
Upvotes: 0
Views: 23
Reputation: 1229
According to the Parse API docs, addUniqueObject
is an atomic operation, so similarly to increment
, 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 addUniqueObject
call should allow both objects to save
Upvotes: 1