As far as I can tell, Apple's documentation on using the CloudKit Dashboard doesn't explain how to look up specific users' records.
So, let's say one of my users wants me to delete their iCloud data from my app's public database.
What's the best way to find that particular record in the CloudKit Dashboard?
There's the createdBy
system field -- but how do I connect that to a user? There's also a recordName
system field that holds an ID of some kind.
Please advise.
Thank you!
When you look at the created/modified field on a record, you'll see below it a long string that is a unique recordName
(it starts with a _
) that corresponds to a user in the Users
table in your container.
You can query the Public
database in the CloudKit Dashboard by that User
recordName
. You can then select those records and delete them.
If it's a lot of records, it would probably be more efficient to write a little Swift code to fetch the recordID
s with a CKQuery
that searches the created or modified field. Once you fetch those recordID
s, you can submit them with a CKModifyRecordsOperation
to delete them.
One final thing. You will probably need to have some way of showing the user their User
recordName
so that they can send it to you to request a deletion of their data. If you haven't associated any other data with the Users
record then you won't be able to tell who is who.