I am currently creating an app that requires a large amount of user generated information to be stored in Core Data. When I release a new update of this app, I want to make sure that these users do not lose all of this data.
When I delete my current version from my iPhone, all of the Core Data disappears- will this happen when I create a new update version- does updating cause all of the Core Data to be deleted as the app is replaced? If so, what do I have to do to preserve the data?
I will not be changing my Core Data model between updates, if that changes anything...
save context at the end of every change. save context only on app's exit (like in Apple's samples) save context on app's exit, going to background or becoming not active (incoming phone call for example) add timer to save context from time to time if it has any changes.
Object graph management: Core Data works with defined objects, and core data keeps track of these objects and their relationships with each other. Persistence: Data can be retrieved, in this case, either from the device or from a network location. SQLite: One of the potential data stores that Core Data can use.
Use Core Data to save your application's permanent data for offline use, to cache temporary data, and to add undo functionality to your app on a single device. To sync data across multiple devices in a single iCloud account, Core Data automatically mirrors your schema to a CloudKit container.
The persistent store should be located in the AppData > Library > Application Support directory.
Simple question - simple answer, the Core Data is backed up to iTunes/iCloud as part of the iPhone backup, and the users data is also persisted between updates.
You can optionally include the core data to be included in an iCloud sync, this means that even deleting the app and reinstalling it, the data will persist.
If you change your model, you are reasonable for mapping the old scheme to the new one, the data is then transferred via this mapping model when the new update occurs, the previous schemes data will get transferred into the new core data scheme.
Core Data versioning: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreDataVersioning/CoreDataVersioning.pdf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With