Reputation: 83
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...
Upvotes: 5
Views: 1373
Reputation: 23359
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
Upvotes: 7
Reputation: 9600
If there is your app in app-store Ver1.0. Updated Ver1.0.1 or higher, CoreData will be maintained. If Core data model changes, although all the previous core data will be maintained.
If there is your app in app-store Ver 1.0. deleting a Ver 1.0. Download it again or download the updated version of, CoreData will be deleted.
If you delete the app, core data will be deleted. To prevent this, using the iCloud synchronization data should work.
refer a following site, iOS How-To : Using Core Data with iCloud
must be you'll read a following Apple PDF: coredata model versioning and data migration programming guide
Upvotes: 3