Я попытался подключить iPhone для создания моего проекта flutter, но возникла эта ошибка:
Conditional cast from 'AppDelegate' to 'UNUserNotificationCenterDelegate' always succeeds
Я думаю, это может быть связано с локальными уведомлениями, но есть не знаю, почему возникает ошибка и как ее исправить.
AppDelegate.swift
import UIKit
import Flutter
import UserNotifications
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}