Search code examples
iosswiftparse-platform

Can I specify a objectId when creating new PFObjects?


Swift / iOS

Can anyone tell me if it is possible to specify the PFObject objectId value when creating new objects?

I've obviously attempted but the save fails. (which might just be the answer)

The reason I am asking is I wondered if anyone had found a "trick" that would allow me to specify.

I am using PFObject.saveInBackground { method to persist the new object.


Solution

  • No you can not. Parse sets the objectId on the server during the save operation.

    The reason your operation is failing is because Parse is looking for an object on the server with the id that you are specifying and is then trying to update that object but it cannot find the object.