Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Following on from Gwynne Raskind answer you can avoid the CFRunLoop exception handler by using GCD to dispatch a call to a block of C++ code synchronously:</p> <pre><code>namespace { void MyThrowingCode() { throw std::runtime_error("My Exception"); } } - (void)objcHandlerCalledFromARunLoop { dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ MyThrowingCode(); }); } </code></pre> <p>You might need to create your own queues rather than using a single shared queue.</p> <p>The crash log looks like this:</p> <pre><code>0 libsystem_kernel.dylib 0x3aa39350 __pthread_kill + 8 1 libsystem_c.dylib 0x3a9affb2 pthread_kill + 54 2 libsystem_c.dylib 0x3a9ec366 abort + 90 3 libc++abi.dylib 0x39f94dda abort_message + 70 4 libc++abi.dylib 0x39f92094 default_terminate() + 20 5 libobjc.A.dylib 0x3a545a70 _objc_terminate() + 168 6 libc++abi.dylib 0x39f92118 safe_handler_caller(void (*)()) + 76 7 libc++abi.dylib 0x39f921b0 std::terminate() + 16 8 libc++abi.dylib 0x39f9359a __cxa_throw + 118 9 Test 0x000fddfc MyThrowingCode() (MainViewController.mm:177) 10 Test 0x000fe38c __35-[MainViewController toolsClick:]_block_invoke (MainViewController.mm:184) 11 libdispatch.dylib 0x3a95f5d8 _dispatch_client_callout + 20 12 libdispatch.dylib 0x3a962776 _dispatch_sync_f_invoke + 22 13 Test 0x000fde90 -[MainViewController toolsClick:] (MainViewController.mm:183) 14 UIKit 0x34744082 -[UIApplication sendAction:to:from:forEvent:] + 66 15 UIKit 0x3474410c -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 116 16 UIKit 0x34744082 -[UIApplication sendAction:to:from:forEvent:] + 66 17 UIKit 0x34744036 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 26 18 UIKit 0x34744010 -[UIControl sendAction:to:forEvent:] + 40 19 UIKit 0x347438c6 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 498 20 UIKit 0x34743db4 -[UIControl touchesEnded:withEvent:] + 484 21 UIKit 0x3466c5f4 -[UIWindow _sendTouchesForEvent:] + 520 22 UIKit 0x346598dc -[UIApplication sendEvent:] + 376 23 UIKit 0x346591ea _UIApplicationHandleEvent + 6194 24 GraphicsServices 0x363715f4 _PurpleEventCallback + 588 25 GraphicsServices 0x36371222 PurpleEventCallback + 30 26 CoreFoundation 0x3281f3e4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32 27 CoreFoundation 0x3281f386 __CFRunLoopDoSource1 + 134 28 CoreFoundation 0x3281e20a __CFRunLoopRun + 1378 29 CoreFoundation 0x32791238 CFRunLoopRunSpecific + 352 30 CoreFoundation 0x327910c4 CFRunLoopRunInMode + 100 31 GraphicsServices 0x36370336 GSEventRunModal + 70 32 UIKit 0x346ad2b4 UIApplicationMain + 1116 33 Test 0x00120462 main (main.mm:55) 34 libdyld.dylib 0x3a972b1c start + 0 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload