Preventing Core Data Errors
I have created a Mac application for the app store - and now find it necessary to modify my 'model' file for Core Data. In my experience, changing this model creates an error upon opening an old file (document based app) that is tied to the old model. I had read in the Apple Documentation that you can prevent this by keeping the old model "versioned" and then creating the new one (I may be mistaken) - doe开发者_运维问答s anyone have any tips on this? I'd hate to get a bunch of angry emails from people who can't open their files. Thanks in advance!
Zach
You might want to check out: Core Data Model Versioning and Data Migration Programming Guide
What you seem to be looking for is "Lightweight Migration".
There are some tips in that documentation:
- when adding new attributes these must be defined as optional
- Renaming items or attributes you need to specify the renaming identifier
- ...
精彩评论