Core data iOS核心数据的轻量级数据迁移示例?
苹果提供了轻量级的迁移,这里是xcode4之前的好地方 在xcode4中似乎有点不同Core data iOS核心数据的轻量级数据迁移示例?,core-data,ios4,data-modeling,data-migration,Core Data,Ios4,Data Modeling,Data Migration,苹果提供了轻量级的迁移,这里是xcode4之前的好地方 在xcode4中似乎有点不同 感谢您提供xcode4中简单示例的任何线索,以说明核心数据的数据迁移。只需注意添加了选项NSDictionary和NSPersistentStoreCoordinator初始值设定项,现在将选项参数设置为从nil到options - (NSPersistentStoreCoordinator *)persistentStoreCoordinator { if (__persistentStoreCoor
感谢您提供xcode4中简单示例的任何线索,以说明核心数据的数据迁移。只需注意添加了选项NSDictionary和NSPersistentStoreCoordinator初始值设定项,现在将选项参数设置为从nil到options
- (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;
}