I see several crash reports with this header:
NSPersistentStoreCoordinator does not have persistent repositories (corrupted file). It cannot perform a save operation. My code for adding persistent storage to the coordinator is here:
NSURL *applicationDocumentsDirectory = [[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask].lastObject;
NSURL *storeURL = [applicationDocumentsDirectory URLByAppendingPathComponent:@"myDatabase.sqlite"];
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"myDataModel" withExtension:@"momd"];
NSManagedObjectModel *managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
NSDictionary *storeOptions = @{NSInferMappingModelAutomaticallyOption:@YES,
NSMigratePersistentStoresAutomaticallyOption:@YES,
NSSQLitePragmasOption:@{@"synchronous": @"OFF"}};
self.persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:managedObjectModel];
NSError *error = nil;
if (![self.persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType
configuration:nil
URL:storeURL
options:storeOptions
error:&error])
{
}
I registered an error that comes out of a call to 'addPersistentStoreWithType' and it looks like this:
NSCocoaErrorDomain 259
NSSQLiteErrorDomain = 11;
NSUnderlyingException = "Fatal error. The database at <path> is corrupted. SQLite Error code:11, 'database disk image is malformed'
, , . ? , , , - , , , .
:
3-6%, 57%, iOS 10. , , , , . , 98% . . , "device_locked", , , , .
