1

更新中のアプリがストアにあります。「lazy var managedObjectModel: NSManagedObjectModel」と「lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator?」の両方で名前を変更するなど、多くのコア データの変更を行いました。

Core Data Migration を適切に使用して、既存のユーザーが更新をダウンロードしたときにアプリがクラッシュしないようにするにはどうすればよいですか?

古い:

NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"MyApp-Model" withExtension:@"momd"];

NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"MyApp.sqlite"];

新しい:

let modelURL = NSBundle.mainBundle().URLForResource("My-App", withExtension: "momd")!

let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("My-App.sqlite")
4

0 に答える 0