Crash register push notification swift6

Hi when setting the language to iOS 6 my app crashes on this piece of code:

func registerForPushNotifications() {
        UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
            print("Permission granted: \(granted)")
            guard granted else { return }
            self.getNotificationSettings()
        }
    }

It has to do with the requestAuthorization When I restart the app it crashes immediately. This is because I had already made a choice for this.

When I change the language back to swift 5 it works fine again. Removing the self.getNotifcationSettings has nothing to do with it.

Also tried to add @MainActor to the function.

This is the tread where it crashes on: Thread 7 Queue : com.apple.usernotifications.UNUserNotificationServiceConnection.call-out (serial)

Does anybody have a idea how to fix this?

We’re talking about this issue over on this thread.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Crash register push notification swift6
 
 
Q