XCode 12 & iOS 14 getting crash and not able to know exact reason

I have added crash log, code is working perfectly fine when I compiled with XCode 11.6 & iOS 13 and iOS 14 also.

But When I am compiling with XCode 12 and run on iOS 14 device. it will start crashing.



The immediate cause of your crash is this:

Code Block
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000019a1add00


This strongly suggests that you’ve hit a trap, that is, the code has detected an unrecoverable problem and deliberately crashed.

Consider the backtrace of the crashing thread:

Code Block
Thread 6 name: Dispatch queue: ELEReportPDFRenderer
Thread 6 Crashed:
0 libdispatch.dylib … _dispatch_assert_queue_fail + 112
1 libdispatch.dylib … _dispatch_assert_queue_fail + 104
2 libdispatch.dylib … dispatch_assert_queue$V2$VARIANT$armv81 + 144
3 UIKitCore … -[UIImageView _mainQ_beginLoadingIfApplicable] + 72
23 UIKitCore … -[UINib instantiateWithOwner:options:] + 1064
24 elektra … +[UIView(Elektra) instantiateWithNibName:bundle:owner:] + 86793224 (UIView+El…
25 elektra … +[UIView(Elektra) instantiateFromNibWithOwner:] + 86790452 (UIView+Elektra.m:…
26 elektra … +[ELEMeasurementView measurementViewWithReuseIdentifier:] + 40093136 (ELEMeas…
27 elektra … +[ELEMeasurementView measurementViewConfiguredForMeasurement:completionBlock:…
28 elektra … -[ELEBasicReportPDFRenderer drawMeasurementGroup:] + 18411720 (ELEBasicReport…
29 elektra … -[ELEReportPDFRenderer PDFData] + 45446276 (ELEReportPDFRenderer.m:390)
30 elektra … +[ELEReportPDFRenderer PDFDataFromReport:progressBlock:] + 45398428 (ELERepor…
31 elektra … __50-[ELEReportContentPreferencesController createPDF]_block_invoke + 4499318…
32 libdispatch.dylib … _dispatch_call_block_and_release + 24
33 libdispatch.dylib … _dispatch_client_callout + 16
34 libdispatch.dylib … _dispatch_lane_serial_drain$VARIANT$armv81 + 568
35 libdispatch.dylib … _dispatch_lane_invoke$VARIANT$armv81 + 404
36 libdispatch.dylib … _dispatch_workloop_worker_thread + 692
37 libsystem_pthread.dylib … _pthread_wqthread + 272
38 libsystem_pthread.dylib … start_wqthread + 8


Frame 38 shows that this is a dispatch worker thread. Frames 31 through 24 are your code, which then calls UIKit at frame 23. This is not legal. You are not allowed to call UIKit from a secondary thread; you can only call it from the main thread.

UIKit has detected this problem and trapped.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Did you ever find a solution to this. I seem to be having something similar.

In one case, I had a message in the log with the statement
BRossTools[2569]: BUG IN CLIENT OF LIBDISPATCH: Assertion failed: Block was expected to run on queue [com.apple.main-thread]

I'm going to try to get things a little more organized and then I can post my code. It seems to occur when I try to capture a key press on the MIDI keyboard

@HighlyExperienced

You need redesign your code to make it main-thread-safety or you can use this snippet for working with UIKit:

void vkm_sync_main(dispatch_block_t block) {
    if (block == nil) return;
    if ([NSThread isMainThread]) {
        block();
    } else {
        dispatch_sync(dispatch_get_main_queue(), block);
    }
}
XCode 12 & iOS 14 getting crash and not able to know exact reason
 
 
Q