I have been investigating a crash where saving a context leads to a crash triggered internally by Core Data. Is there any information on what exception or fatal error it is? Or any hint of any kind which leads to NSManagedObjectContext.m:1475 (seems like this line calls abort or some sort of fatal error). Seems like this happens when the app is in background.
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000019266a3f8
Termination Reason: SIGNAL 5 Trace/BPT trap: 5
Terminating Process: exc handler [38173]
Triggered by Thread: 9
…
Thread 9 Crashed:
0 CoreData 0x000000019266a3f8 -[NSManagedObjectContext _thereIsNoSadnessLikeTheDeathOfOptimism] + 36 (NSManagedObjectContext.m:1475)
1 CoreData 0x00000001925c8fa0 -[NSManagedObjectContext save:] + 1844 (NSManagedObjectContext.m:1688)
2 MyApp 0x0000000102cc747c closure #1 in DatabaseContainer.write(_:completion:) (in MyApp) (DatabaseContainer.swift:233) + 7861372
3 MyApp 0x0000000102baab14 thunk for @escaping @callee_guaranteed () -> () (in MyApp) (<compiler-generated>:0) + 6695700
4 CoreData 0x000000019252dfe8 developerSubmittedBlockToNSManagedObjectContextPerform + 156 (NSManagedObjectContext.m:3985)
5 libdispatch.dylib 0x00000001922e2dd4 _dispatch_client_callout + 20 (object.m:576)
6 libdispatch.dylib 0x00000001922ea400 _dispatch_lane_serial_drain + 748 (queue.c:3900)
7 libdispatch.dylib 0x00000001922eaf30 _dispatch_lane_invoke + 380 (queue.c:3991)
8 libdispatch.dylib 0x00000001922f5cb4 _dispatch_root_queue_drain_deferred_wlh + 288 (queue.c:6998)
9 libdispatch.dylib 0x00000001922f5528 _dispatch_workloop_worker_thread + 404 (queue.c:6592)
10 libsystem_pthread.dylib 0x00000001e6e8c934 _pthread_wqthread + 288 (pthread.c:2696)
11 libsystem_pthread.dylib 0x00000001e6e890cc start_wqthread + 8 (:-1)