lurning too koad
lurning too koad

Reputation: 2964

How to debug with breakpoint when crash line is the App Delegate?

Ever since upgrading to the latest Xcode, I've experienced random/intermittent crashes on app launch that I can only reproduce by launching the app n times and waiting for it to return. The line that the app crashes on is the top of the App Delegate:

class AppDelegate: UIResponder, UIApplicationDelegate {

I don't know how I'd set a breakpoint here and what I could gather from it. The reported cause of the crash is an NSException error on Thread 1:

[_NSTaggedDate countByEnumeratingWithState:objects:count]: unrecognized selector sent to instance 0x8000000000000000

Backtrace:

* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x000000019b7c6d88 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x000000019b6df1e8 libsystem_pthread.dylib`pthread_kill$VARIANT$mp + 136
    frame #2: 0x000000019b632934 libsystem_c.dylib`abort + 100
    frame #3: 0x000000019b79acc0 libc++abi.dylib`abort_message + 128
    frame #4: 0x000000019b78ce10 libc++abi.dylib`demangling_terminate_handler() + 296
    frame #5: 0x000000019b6f3e80 libobjc.A.dylib`_objc_terminate() + 124
    frame #6: 0x000000019b79a14c libc++abi.dylib`std::__terminate(void (*)()) + 16
    frame #7: 0x000000019b79a0e4 libc++abi.dylib`std::terminate() + 44
    frame #8: 0x000000019b6f3e04 libobjc.A.dylib`objc_terminate + 12
    frame #9: 0x0000000105e2b744 libdispatch.dylib`_dispatch_client_callout + 36
    frame #10: 0x0000000105e39710 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 976
    frame #11: 0x000000019b94f7fc CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
    frame #12: 0x000000019b94a6d0 CoreFoundation`__CFRunLoopRun + 1724
    frame #13: 0x000000019b949ce8 CoreFoundation`CFRunLoopRunSpecific + 424
    frame #14: 0x00000001a5a9438c GraphicsServices`GSEventRunModal + 160
    frame #15: 0x000000019fa78444 UIKitCore`UIApplicationMain + 1932
    frame #16: 0x0000000100fc866c FXTracker`main at AppDelegate.swift:8:7
    frame #17: 0x000000019b7d18f0 libdyld.dylib`start + 4

In the debug navigator window, it's opened to Thread 1 and there is a drop-down called Original Exception Backtrace which looks like this:

0 _exceptionPreprocess
9 Sequence<>.contains(_:)
10 closure #3 in closure #1 in closure #2 in FXEditorViewController.loadBadges()
19 UIApplicationMain
20 main
21 start

Is it safe to say that the crash is caused by closure #3 in closure #1 in closure #2 in loadBadges()?

Upvotes: 3

Views: 1675

Answers (1)

Asperi
Asperi

Reputation: 257663

In this case you can set exception breakpoints

here

demo

and then here (in Exceptions -> All)

demo2

Upvotes: 3

Related Questions