我的应用最近已从仅在iOS9上发生的crashlytics中获取这些崩溃
致命异常:NSInternalInconsistencyException
此NSPersistentStoreCoordinator没有持久存储(损坏的文件)。它无法执行保存操作。
报告中的最后一个电话是
-[NSPersistentStoreCoordinator _coordinator_you_never_successfully_opened_the_database_device_locked:]
Run Code Online (Sandbox Code Playgroud)
这就是NSPersistentStoreCoordinator的创建方式
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator{
if (_persistentStoreCoordinator != nil) {
return _persistentStoreCoordinator;
}
AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
NSURL *storeURL = [[delegate applicationDocumentsDirectory] URLByAppendingPathComponent:@"database.sqlite"];
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:self.managedObjectModel];
NSError* error = nil;
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType
configuration:nil
URL:storeURL
options:@{NSMigratePersistentStoresAutomaticallyOption:@YES, NSInferMappingModelAutomaticallyOption:@YES} error:&error])
{
NSLog(@"Error adding persistent store. %@, %@", error, error.userInfo);
return nil;
}
return _persistentStoreCoordinator;
}
Run Code Online (Sandbox Code Playgroud)
有人知道是什么原因导致这些崩溃吗?