CREATE operation not permitted

后端 未结 2 1933
一生所求
一生所求 2021-01-25 17:01

I am trying to utilize CloudKit in my iOS application, but when I attempt to create a new record for for a User record type (record type is named

相关标签:
2条回答
  • 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.

    0 讨论(0)
  • 2021-01-25 17:29

    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.

    0 讨论(0)
提交回复
热议问题