//創(chuàng)建一個更新選項 字典類型
NSDictionary *option = @{NSInferMappingModelAutomaticallyOption:@"YES",NSMigratePersistentStoresAutomaticallyOption:@"YES"};
加到AppDelegate中以下方法
//創(chuàng)建一個更新選項 字典類型
NSDictionary *option = @{NSInferMappingModelAutomaticallyOption:@"YES",NSMigratePersistentStoresAutomaticallyOption:@"YES"};
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:option error:&error]) {
// Report any error we got.
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
dict[NSLocalizedDescriptionKey] = @"Failed to initialize the application's saved data";
dict[NSLocalizedFailureReasonErrorKey] = failureReason;
dict[NSUnderlyingErrorKey] = error;
error = [NSError errorWithDomain:@"YOUR_ERROR_DOMAIN" code:9999 userInfo:dict];
// Replace this with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}