How do I set up Core Data lightweight migration using MagicalRecord?

泪湿孤枕 提交于 2019-12-03 14:46:30

The whole point of MagicalRecord is that this is managed for you:

[MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:####];

Check the docs about the Core Data stack setup here.

Make sure you check all of these things:

In your AppDelegate.m file:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    ...
    [MagicalRecord setupAutoMigratingCoreDataStack];
    ...
}

If you haven't versioned your model already:

  • Select your data model

  • Editor -> Add Model Version

  • Name the new version, Finish

  • There should be two versions now. Select the file as shown.

  • Change the Model Version to your new version

  • The new version should be checked now

As of my understanding of the question, i suggest you to use this

[MagicalRecord setupAutoMigratingCoreDataStack]

If you have not changed the model version, change it to new model created from the old model

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!