CoreData database migration operations and coredata database migration
The procedure for migrating the CoreData database is based on Xcode7.
1. Add a new database. Select the current database version: Editor-> Add Model Verson to create a new database version.
2. command + N to create a ing model. iOS-> CoreData-> Mapping Model-> Next, select the old database version-> Next, select the new database version-> Create.
3. Select a database, the first tab on the right toolbar-> ModelVerson-> current, and select the latest database version.
4. Select the latest database to create a new object class .:
5. in AppDelegate. find the method in the m file:-(NSPersistentStoreCoordinator *) persistentStoreCoordinator;, and add a dictionary to options in the implementation of the method: @ {NSInferMappingModelAutomaticallyOption: @ (YES), callback: @ (YES )}. for example:
After the above process, you can complete the database migration.