CREATE operation not permitted

时光毁灭记忆、已成空白 提交于 2019-12-02 06:50:26

Users is a special recordType that already exist in CloudKit. You should not create records yourself. Records will be automatically created for new users that are using your app. You also can't create subscriptions and query the Users recordtype. You can only query Users records directly by ID. You can store extra data in the Users recordType, but I think in your case it would be better if you named your record type something else.

In addition to Edwin's answer, it's entirely feasible to save custom fields to the public Users recordType, but you need to retrieve the CKRecordID for the user first (via CKContainer fetchUserRecordID() or discoverUserIdentity()) and then build the CKRecord on Users using that ID.

Also, if you're using CKModifyRecordsOperation make sure the savePolicy is set to .changedKeys in order to allow the update to go through.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!