diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index f00a7f65..f667e15e 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -11,6 +11,12 @@ import UserNotifications didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { FirebaseApp.configure() + + // Start APNs registration during native launch. With Flutter's implicit-engine + // lifecycle, Firebase Messaging plugin registration happens later, which can + // otherwise leave the APNs token unavailable when Dart first accesses FCM. + application.registerForRemoteNotifications() + let flutterResult = super.application(application, didFinishLaunchingWithOptions: launchOptions) return flutterResult } diff --git a/kids/ios/Runner/AppDelegate.swift b/kids/ios/Runner/AppDelegate.swift index 9fb13d79..f85b46dd 100644 --- a/kids/ios/Runner/AppDelegate.swift +++ b/kids/ios/Runner/AppDelegate.swift @@ -9,6 +9,12 @@ import UIKit didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { FirebaseApp.configure() + + // Start APNs registration during native launch. With Flutter's implicit-engine + // lifecycle, Firebase Messaging plugin registration happens later, which can + // otherwise leave the APNs token unavailable when Dart first accesses FCM. + application.registerForRemoteNotifications() + return super.application(application, didFinishLaunchingWithOptions: launchOptions) }