Post

Replies

Boosts

Views

Activity

Reply to Crash in Swift 6 when using UNUserNotification
You are receiving the notification in an arbitrary background thread. Make didReceive nonisolated and do whatever you do inside it, in a MainActor isolated task. Do not change willPresent to nonisolated. It needs to be called on MainActor since it is a function about the user interface. If you are posting the notification yourself, I recommend posting it on MainActor to get rid of most concurrency related issues. Be aware that the system and frameworks will continue posting from an arbitrary thread.
3w