I try to add CloudKit support to my iOS app. My goal is to save data to user's privateCloudDatabase and be able to restore it if user change phone/reinstall app. Everything works great, but user can't delete app data from iCloud(from code I can delete it successfully)
Precondition: user device have iCloud enabled
Steps to reproduce(ios 13, but reproduces on any ios):
- From code save a
CKRecordto user's privateCloudDatabase - On user's device go to settings > Apple ID(on top) > iCloud > Manage Storage > my application > Delete Data > Delete
Expected result: applications list updated and my app not in the list
Actual result: my app is still in the list
Here's how I add record to iCloud:
let record = CKRecord(recordType: "backup", recordID: CKRecord.ID(recordName: "userName"))
let operation = CKModifyRecordsOperation(recordsToSave: [record], recordIDsToDelete: nil)
operation.savePolicy = .allKeys
operation.modifyRecordsCompletionBlock = { savedRecords, deletedRecords, error in
print(error)
}
CKContainer.default().privateCloudDatabase.add(operation)
I expect that user can go to Settings and manually remove app data from iCloud. Otherwise if user delete my app he won't be able to delete this data from iCloud forever(yes, I tried to delete app and then delete data - result is the same)
Video: https://www.youtube.com/watch?v=UGk0hpi8gtA
Question: Is it a bug or I missing something? Any workaround to fix this?
Update: I found in app store application, which probably uses CloudKit, and if I install it - it can't be deleted from my iCloud storage forever. https://apps.apple.com/us/app/ulysses/id1225571038