Swift 6 Gave Me Zero Warnings, but Two Objective-C Callbacks Still Crashed at Runtime
Three crash reports came off my iPhone over three days, all identical:
# summarized from the .ips JSONException: EXC_BREAKPOINT (SIGTRAP)Queue: com.apple.BGTaskScheduler (…skymoment.refresh)Stack: _dispatch_assert_queue_fail dispatch_assert_queue _swift_task_checkIsolatedSwift
My app, Amana, draws the sky and nudges you to go outside and look at the real one. It's built in Swift 6 language mode, and I had also tried SWIFT_STRICT_CONCURRENCY=complete. The compiler said nothing about the code that crashed: zero warnings. The tests were green. And yet the app was dying in the background.
A week later, the same crash came through a different Apple API. This post covers both, plus a minimal reproduction rebuilt today on Xcode 27 / Swift 6.4.
The first crash: BGTaskScheduler
Here's the code that shipped (trimmed, comment translated):
@MainActorfinal class SkyMomentBackgroundRefresher { func register(manager: SkyMomentManager) { // The launch handler is called from an arbitrary thread, // so it crosses the @MainActor boundary: wrap it in a Task....
Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE