Join Simon Allardice for an in-depth discussion in this video Dealing with schema changes, part of Core Data for iOS and OS X.
Something you may well have run into already in your experimentation with Core Data, what…happens if you change your data model after you've begun to actually use that data model…in a running application?…So here I have this simple Courses application I have created, a bunch of objects here.…And let's say now I decide that my data model needs a tweak.…We need a bit more information.…So I'll go into the Data Model file and just add a simple new attribute, I'll call it category…and make it a String. Save that and run the application again.…
We are immediately going to run into a problem, basically the thing will blow up.…It will give me a whole bunch of information, but the thing I'm most interested in is the reason.…The model used to open the store is incompatible with the one used to create the store.…That's a pretty clear error message, and it shouldn't really surprise us.…We are changing the basic format of how this information has saved, which means we are changing how it's loaded.…It's the equivalent of changing a relational database schema, or a file format, in an existing application.…
- Understanding Core Data and object persistence frameworks
- Creating a Core Data project
- Exploring data modeling
- Creating entities, attributes, and relationships
- Creating managed objects
- Fetching in Core Data
- Implementing undo and redo support
- Creating a Core Data Cocoa app without code
- Responding to validation issues
- Converting store types
- Preloading default data
Skill Level Intermediate
Q: In the CoursesViewController.m file, I receive a message that the method dismissModalViewControllerAnimated is no longer supported by Apple. Is there a newer method to use?
A: You may have received the warning that a call to the dismissModalViewControllerAnimated: method is now deprecated.
This is a recently deprecated method, so the code _will_ continue to work using that call, but to remove the warning, change the code from:
to the current recommended version:
[self dismissViewControllerAnimated:YES completion:nil];
It should take care of that message.