// context is an instance of NSManagedObjectContext
context.performAndWait {
do {
guard context.hasChanges else {
return
}
try context.save()
} catch {
print("Error...")
}
}
Does anyone understand why the line containing try context.save()
would appear to cause the following crash?
Fatal Exception: NSInternalInconsistencyException This NSPersistentStoreCoordinator has no persistent stores (disk full). It cannot perform a save operation
This is part of the stack trace:
Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x19d4c99d8 __exceptionPreprocess
1 libobjc.A.dylib 0x1b184fb54 objc_exception_throw
2 CoreData 0x1a33b42d8 -[NSPersistentStoreCoordinator _coordinator_you_never_successfully_opened_the_database_io_error:]
3 CoreData 0x1a33b4370 -[NSPersistentStoreCoordinator _introspectLastErrorAndThrow]
4 CoreData 0x1a33b49c8 __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke.797
5 CoreData 0x1a324b408 -[NSPersistentStoreCoordinator _routeHeavyweightBlock:]
6 CoreData 0x1a324c2d0 -[NSPersistentStoreCoordinator executeRequest:withContext:error:]
7 CoreData 0x1a324c2fc -[NSPersistentStoreCoordinator executeRequest:withContext:error:]
8 CoreData 0x1a324d270 -[NSManagedObjectContext save:]
The throwing method is wrapped in a do-try-catch, which should prevent the application from crashing, yet this is being reported as a crash by Firebase (Crashlytics).