AppDelegate.swift 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. import Flutter
  2. import UIKit
  3. import flutter_local_notifications
  4. @main
  5. @objc class AppDelegate: FlutterAppDelegate {
  6. override func application(
  7. _ application: UIApplication,
  8. didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  9. ) -> Bool {
  10. FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in
  11. GeneratedPluginRegistrant.register(with: registry)
  12. }
  13. if #available(iOS 10.0, *) {
  14. UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
  15. }
  16. GeneratedPluginRegistrant.register(with: self)
  17. SwiftFlutterForegroundTaskPlugin.setPluginRegistrantCallback(registerPlugins)
  18. return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  19. }
  20. override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
  21. super.application(application, didReceiveRemoteNotification: userInfo, fetchCompletionHandler: completionHandler)
  22. }
  23. }
  24. func registerPlugins(registry: FlutterPluginRegistry) {
  25. GeneratedPluginRegistrant.register(with: registry)
  26. }