I am trying to find error handling information when creating a persistent storage coordinator on an iPhone. I implemented easy migration
NSError *error = nil; NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, 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;
This is based on Apple code with added support for lightweight migration.
I cannot find any error handling information if the application still encounters an error here. It seems to me that if the database cannot be created, the application cannot be used at all.
- Will I just ask the user to try reinstalling the application and display the relevant information?
- Can I save the abort () statement when adding an error request or will this lead to a rejection of the Apple application?
source share