I know that if you change the Core Data model and you have run the app before on the old model that you will get Persistent Store error. How would you handle changes to the Core Data model so you do not get this error? Is there a way to upgrade an old model so that the already saved data is not lost?
Core Data comes with a built-in mechanism to handle changes to your model.
Take a look at the Core Data Model Versioning and Data Migration Programming Guide for details.
If 10.6 is your baseline OS then you can use lightweight migration, specifically NSInferMappingModelAutomaticallyOption.
The article I wrote is similar and useful if 10.6 is not your baseline OS.
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