< Back
Page 7 of 7
From the Rough Cut
Exercises
Exercises
Why not build on what you’ve learned by experimenting?
- Set the current model version to Model 3 and run the application. It should not crash because the downgrade of data is inferred automatically. Note that this is only because NSInferMappingModelAutomaticallyOption has been re-enabled. In reality, you would need a Model4toModel3 mapping model to map attributes properly.
- Examine the contents of the ZAMOUNT table in Grocery-Dude.sqlite and you’ll notice something critical: Where has all the data gone? There was no mapping model, so all the ZUNIT data was lost during the downgrade!
- Set the current model to Model 4 and re-enable the migration manager in the loadStore method of CoreDataHelper.m by setting useMigrationManager to YES.
- Run the application to witness another manual migration, which will be extremely fast because there is no data in the store. Set useMigrationManager to NO before continuing to the next chapter.
< Back
Page 7 of 7