saoudrizwan / Disk

Easily persist structs, images, and data on iOS
MIT License
3.1k stars 170 forks source link

backup (and restore) to iCloud not working #31

Closed benrudhart closed 6 years ago

benrudhart commented 6 years ago

I'm saving files in the documents directory and expected them to be automatically backed up to iCloud (and restored after app deletion and new install). I also enabled the iCloud entitlement in the app capabilities but it still doesn't work. Tried to enable backup to iCloud (if it was somehow disabled) by using Disk.backup(filename, in: .documents) but no luck here either.

Do you have any ideas what could cause this behavior? (yes, I'm logged in with my Apple ID)

saoudrizwan commented 6 years ago

Files saved in your app's directory aren't saved to iCloud automatically. The user needs to first backup his device, and then the files get saved so when he restores from that backup, your Document files will be there then. If you want to persist data after app deletion, I recommend using CloudKit.

Read more here: https://developer.apple.com/icloud/documentation/data-storage/index.html

benrudhart commented 6 years ago

thank you for the explanation!