[英]Can I specify a objectId when creating new PFObjects?
Swift / iOS 斯威夫特/ iOS
Can anyone tell me if it is possible to specify the PFObject objectId
value when creating new objects? 谁能告诉我在创建新对象时是否可以指定PFObject objectId
值?
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. 我正在使用PFObject.saveInBackground {
方法来持久化新对象。
No you can not. 你不能。 Parse sets the objectId on the server during the save operation. 解析在保存操作期间在服务器上设置objectId。
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. 您的操作失败的原因是因为Parse在服务器上使用您指定的ID查找对象,然后尝试更新该对象,但找不到该对象。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.