0
アップルは軽量マイグレーションのdocを提供しています。これはxcode4より前にはsampleです。iOSコアデータの軽量データ移行のサンプル?
xcode4では少し違って見えます。
コアデータのデータ移行を示すxcode4の簡単なサンプルの手がかりがありがとうございました。
アップルは軽量マイグレーションのdocを提供しています。これはxcode4より前にはsampleです。iOSコアデータの軽量データ移行のサンプル?
xcode4では少し違って見えます。
コアデータのデータ移行を示すxcode4の簡単なサンプルの手がかりがありがとうございました。
ただオプションNSDictionaryのとNSPersistentStoreCoordinator初期化子の添加は今ゼロからオプションに設定されたオプションの引数を持って注意し
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
if (__persistentStoreCoordinator != nil)
{
return __persistentStoreCoordinator;
}
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"TradiesDB.sqlite"];
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
[NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
NSError *error = nil;
__persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
if (![__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&error])
{
/*
...
*/
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
return __persistentStoreCoordinator;
}