简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM