BLACK FRIDAY: Save 50% on all my Swift books and bundles! >>

SOLVED: User data backup

Forums > iOS

My app stores json files and images in the documents directory (local). When the user deletes the app all data is gone too, right? I want to provide a safeguard against that. Some questions related to that?

  1. Will my apps data be backed up with the device backup? If so can the user get the data back after deletion of the app and reinstalling?
  2. should I provide a backup/restore option myself. If so, would it be wise to store that on iCloud (container) ?

Thanks!

3      

Data in the Documents directory does get backed up when iOS backs up the device (either to iCloud or a Mac). This will mean that the user data for the app will be reinstalled if the user has to erase and reset the device, or sets up a new device.

However, this will not persist the data after the app is deleted. Apps have their own sandboxed directories and the Documents directory is deleted when the app is deleted.

You need to use an off-device backup, such as CloudKit (which is excellent, in my opinion), or implement your own if you have your own server and backend.

An alternative is allowing a user to export data to store elsewhere and then import it again, but this relies on the user doing that regularly!

4      

@chriswilson1982 Thank you. I thought as much. Might reconsider putting the app's data on incloud, but I ran into other issues with that (mainly sharing the data bewteen devices, I have another thread on that).

4      

Save 50% in my WWDC sale.

SAVE 50% All our books and bundles are half price for Black Friday, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.