0
我想要应用程序版本更新,但在新版本中,我在核心数据中添加了两个新属性,我想将数据从旧版本迁移到新版本。我的步:核心数据模型版本控制和数据迁移
- 选择.xcdatamodeld文件,然后编辑 - >添加模型版本
- 设计>数据模型>设置当前版本。
修改选项
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil]; if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:options error:&error])
但我的新版本没有发现从老版本的任何数据。 如何修改它。