Open m1entus opened 2 days ago
Hi, I got the same problem. But I found out that it has to do with iOS 18 and not swift 6. When using a simulator below iOS 18 it all works fine it seems.
So I think we need to wait for a bug fix on iOS 18 that compiles with swift 6.
So if you want to go further with your migration from swift 5 to 6. I suggest you use a lower iOS version to test.
Also maybe good to know how to fix the data race
@MainActor private func registerForPushNotifications() { UNUserNotificationCenter.current().delegate = self let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound] UNUserNotificationCenter.current().requestAuthorization( options: authOptions, completionHandler: { @Sendable _, _ in }) Messaging.messaging().delegate = self UIApplication.shared.registerForRemoteNotifications() }
So you need to add the @Sendable to the completionHandler
Description
I am getting crash on Swift 6.0 where all works fine on 5.9, can be related to retroactive implementation. Seems for UNUserNotificationService code stopped on
dispatch_assert_queue
which can be Foundation issue with Swift 6.0 but other stack dump might be related to retroactive (see additional information).Reproduction
Inside
@main
AppDelegate i haveapplicationDidBecomeActive
which call this method which causes a crash on swift 6.0 but not cause when i have swift 5.9:Worth mention that i include SPM packages
Models
which contains this code:When i changed method
registerForRemoteNotificationsIfAuthorized
to this implementation it works fine:Personally feel this can something related to
@retroactive
, because i tried to migrate other module and seeing crash on classes where@retroactive
implemented too.Stack dump
Expected behavior
Should not crash
Environment
Swift 6.0 (6.0.0.9.10) - Xcode 16 Release
Additional information
Other place stack dump that i am getting some crash and custom actors are implemented is:
Inside initializer i have: