After porting code to Swift 6 (Xcode 16.4), I get a consistent crash (on simulator) when using UNUserNotificationServiceConnection
It seems (searching on the web) that others have met the same issue. Is it a known Swift6 bug ? Or am I misusing UNUserNotification ?
I do not have the crash when compiling on Xcode 26 ß5, which hints at an issue in Xcode 16.4.
Crash log:
Thread 10 Queue : com.apple.usernotifications.UNUserNotificationServiceConnection.call-out (serial)
As far as I can tell, it seems error is when calling
nonisolated func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)
I had to declare non isolated to solve a compiler error.
Main actor-isolated instance method 'userNotificationCenter(_:didReceive:withCompletionHandler:)' cannot be used to satisfy nonisolated requirement from protocol 'UNUserNotificationCenterDelegate'
I was advised to:
Add 'nonisolated' to 'userNotificationCenter(_:didReceive:withCompletionHandler:)' to make this instance method not isolated to the actor
I filed a bug report: Aug 10, 2025 at 2:43 PM – FB19519575