Похоже, ошибка Xcode. Я на 11.4, а мой симулятор на 13.4. По какой-то причине запускается обработчик сбоя.
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) {
granted,
_ in
if granted {
DispatchQueue.main.async {
application.registerForRemoteNotifications()
}
}
}
return true
}
func application(_: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
print("registed")
}
func application(_: UIApplication,
didFailToRegisterForRemoteNotificationsWithError error: Error) {
assertionFailure(String(describing: error))
}
Ошибка: Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo={NSLocalizedDescription=remote notifications are not supported in the simulator}