{
  "id": 9164801,
  "title": "Swift 6 Gave Me Zero Warnings, but Two Objective-C Callbacks Still Crashed at Runtime",
  "url": "https://urgent.news/2026/09/22/swift-6-gave-me-zero-warnings-but-two-objective-c-callbacks-still",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-22T14:42:08.000Z",
  "source": {
    "name": "HackerNoon",
    "slug": "hackernoon",
    "url": "https://hackernoon.com/swift-6-gave-me-zero-warnings-but-two-objective-c-callbacks-still-crashed-at-runtime?source=rss"
  },
  "original_language": "en",
  "account": "Three separate crash reports came from a Swift 6 app named Amana over a three-day period. All three crashes were identical, with the same \"EXC_BREAKPOINT (SIGTRAP)\" error occurring on the \"com.apple.BGTaskScheduler\" queue. The app, built with Swift 6 language mode, uses a BGTaskScheduler to perform background tasks, but the crash was unrelated to warnings from the compiler.\n\nThe background task was registered using BGTaskScheduler.shared.register(forTaskWithIdentifier:using:), which by default uses a background queue. However, the closure handling the task was declared with @MainActor, causing the Swift runtime to check if the task was running on the main actor's executor. Since the task was running on a different queue, the check failed, resulting in the crash.\n\nTo fix the issue, the BGTaskScheduler's using parameter was changed to .main, matching the declaration of the closure. This ensured the task was executed on the correct queue and the crash was resolved. The same issue was later encountered with Apple's PhotoKit, where a closure inside a @MainActor method led to a crash when running on the \"com.apple.PHPhotoLibrary.changes\" queue. By moving the closure out of the actor, the crash was eliminated.",
  "summary": "How two Objective-C callbacks triggered Swift 6 actor-isolation crashes despite zero compiler warnings, and how the bugs were reproduced and fixed.",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}