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])
但我的新版本沒有發現從老版本的任何數據。 如何修改它。