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;
}