1
votes

We have created an iOS app that saves to CoreData and then syncs to CloudKit. On testing, we have not found a way to purge the data from the apps iCloud container (for the user private data). Can only delete from what we know is there. If we have syncing issues and something gets 'stuck in iCloud' we are not sure how to purge for a clean re-start. Any ideas on how to fully clean iCloud.
Updated info: CloudKit private databases. No zones. Purge all data of the app for a clean new start. The user of the app would have this control. Intended result: from the app, the user can quickly delete all user data they have saved. I may not be asking the right question or missing something - appreciate any guidance.

1
You have not provided any useful details. How are you using CloudKit? Are you using the public database? The private database? A shared database? Are you using any zones besides the default zone? How do you want the deletion to happen? Do you want a single user to be able to delete their own data from their own database? Do you want to be able to quickly delete all users data? Edit your question (don't reply in a comment) with sufficient details about what data you have and what you need to remove. - rmaddy
Thank you for guidance on better, useful information. I have edited the above info. - RickardTF

1 Answers

2
votes

If you are using the private database with "no zone", you are really using the default zone. In order to delete all data from the default zone you need to query every record id for every record type and perform a deletion of every result. This is very inefficient.

I suggest that instead of using the default zone in the user's private database, you create and use a custom zone in the user's private database. Then if you ever need to remove all data for the user, simply delete the zone. One call, simple and efficient.