CloudKit iOS: user can't delete application data

Viewed 398

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):

  1. From code save a CKRecord to user's privateCloudDatabase
  2. 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

1 Answers

I just tried this as well and the app doesn't disappear from the list immediately, but if you reload the list of apps, it works. Try these steps:

  1. Delete the app from the list.
  2. Wait a minute or so.
  3. Go out to the iCloud settings then go back into Manage Storage and the app should be gone.

If it still doesn't work after manually reloading the list, I suggest filing a bug with Apple: feedbackassistant.apple.com

Related