アプリのバージョンアップをしたいのですが、新しいバージョンではコアデータに2つの新しい属性を追加し、古いバージョンから新しいバージョンにデータを移行したいです。私のステップ:
- .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])
しかし、私の新しいバージョンでは、古いバージョンのデータは見つかりませんでした。それを変更する方法。