I’m migrating a small SwiftUI macOS app to Swift 6 with strict concurrency, and have managed to fix all the compile-time errors. However, now my app crashes on startup. All I get is the following information:
libdispatch.dylib`_dispatch_assert_queue_fail:
0x10033c974 <+0>: pacibsp
0x10033c978 <+4>: sub sp, sp, #0x50
0x10033c97c <+8>: stp x20, x19, [sp, #0x30]
0x10033c980 <+12>: stp x29, x30, [sp, #0x40]
0x10033c984 <+16>: add x29, sp, #0x40
0x10033c988 <+20>: adrp x8, 70
0x10033c98c <+24>: add x8, x8, #0xd27 ; "not "
0x10033c990 <+28>: adrp x9, 69
0x10033c994 <+32>: add x9, x9, #0x541 ; ""
0x10033c998 <+36>: stur xzr, [x29, #-0x18]
0x10033c99c <+40>: cmp w1, #0x0
0x10033c9a0 <+44>: csel x8, x9, x8, ne
0x10033c9a4 <+48>: ldr x10, [x0, #0x48]
0x10033c9a8 <+52>: cmp x10, #0x0
0x10033c9ac <+56>: csel x9, x9, x10, eq
0x10033c9b0 <+60>: stp x9, x0, [sp, #0x10]
0x10033c9b4 <+64>: adrp x9, 70
0x10033c9b8 <+68>: add x9, x9, #0xcf6 ; "BUG IN CLIENT OF LIBDISPATCH: Assertion failed: "
0x10033c9bc <+72>: stp x9, x8, [sp]
0x10033c9c0 <+76>: adrp x1, 70
0x10033c9c4 <+80>: add x1, x1, #0xcc1 ; "%sBlock was %sexpected to execute on queue [%s (%p)]"
0x10033c9c8 <+84>: sub x0, x29, #0x18
0x10033c9cc <+88>: bl 0x10037eac0 ; symbol stub for: asprintf
0x10033c9d0 <+92>: ldur x19, [x29, #-0x18]
0x10033c9d4 <+96>: str x19, [sp]
0x10033c9d8 <+100>: adrp x0, 70
0x10033c9dc <+104>: add x0, x0, #0xd2c ; "%s"
0x10033c9e0 <+108>: bl 0x10037ac8c ; _dispatch_log
0x10033c9e4 <+112>: adrp x8, 103
0x10033c9e8 <+116>: str x19, [x8, #0x428]
-> 0x10033c9ec <+120>: brk #0x1
Thread 3: EXC_BREAKPOINT (code=1, subcode=0x10033c9ec)
I don’t really know what this is telling me, and I don’t really know how to debug it either. The crash seems to happen on the init
method of my App
:
struct FocalApp: App {
@NSApplicationDelegateAdaptor(AppDelegate.self) var delegate
@StateObject var timerViewModel = TimerViewModel.shared
@StateObject var settingsManager = SettingsManager.shared
init() { // CRASH HERE: breakpoint on this line is reached, but the closure is not.
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { (success, error) in }
}
}
How do I debug this?