Repository navigation
[firebase_messaging]: 16.5.0 never receives APNs token under UIScene (apns-token-not-set) — regression from 16.4.3 #18555
Description
Activity
- addedNeeds AttentionThis issue needs maintainer attention.This issue needs maintainer attention.platform: iosIssues / PRs which are specifically for iOS.Issues / PRs which are specifically for iOS.type: bugSomething isn't workingSomething isn't working
on Aug 10, 2026 Hi @kylehuang17, thanks for the report. We'll investigate this further.
Hi @kylehuang17, I followed your steps to reproduce the issue on my end using the firebase_messaging example app, but I wasn't able to reproduce it.
Have you tried running the app on a different iOS device? If so, was the issue still reproducible? Also, have you tried reproducing it with Flutter
3.44.0?If the issue persists, could you please share a minimal reproducible example that I can run locally? That would help me investigate this further. Thanks!
- addedblocked: customer-responseWaiting for customer response, e.g. more information was requested.Waiting for customer response, e.g. more information was requested.and removedNeeds AttentionThis issue needs maintainer attention.This issue needs maintainer attention.
on Aug 10, 2026 Confirming this on a second app and a different physical device, and notably without the
configureNotificationCenterDelegate()call — so the regression doesn't depend on having adopted the 16.5.0 UIScene guidance.Environment
firebase_messaging16.4.0 → 16.5.0, as part of a wider FlutterFire bumpfirebase_core4.13.0, Firebase iOS SDK 12.17.0 (CocoaPods; SPM disabled)- Flutter 3.44.9 stable, Dart 3.12.2
- Physical iPhone 16 Pro (
iPhone17,1), iOS 26.6 UIApplicationSceneManifestwith aSceneDelegate: FlutterSceneDelegatesubclassAppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate, plugins registered indidInitializeImplicitFlutterEngine- Swizzling enabled (no
FirebaseAppDelegateProxyEnabledkey) aps-environment: development, notification permission already granted
Symptom
Our registration path only polls once
getNotificationSettings()reportsauthorized, so permission is confirmed granted at the time of the call. PollinggetAPNSToken()40 × 300ms:Runner flutter: APNs token unavailable after 12125ms Runner flutter: APNs token unavailable after 12114msNull for the full 12s, on both calls within a single launch.
onTokenRefreshnever fires and no FCM token is ever obtained. The same device registered normally on the previous build.Re: Flutter 3.44 — reproduces on 3.44.9 stable, so this isn't specific to 3.41.x.
Difference from the original report: we never called
FLTFirebaseMessagingPlugin.configureNotificationCenterDelegate(). The original report applied that guidance and still lost the token; we never applied it and also lost the token. So the APNs device-token path appears broken under scene lifecycle independently of notification-center delegate setup.Pinning
firebase_messaging: 16.4.3while leavingfirebase_core4.13.0 / Firebase iOS SDK 12.17.0 and every other FlutterFire plugin at their latest resolves cleanly in CocoaPods and restores APNs token delivery on the same device — which also isolates this to the messaging plugin rather than the 12.17.0 SDK bump.No standalone minimal repro yet; happy to put one together if the config above isn't enough to go on.
I'm experiencing the same issue on an iPhone XR.
The issue was recorded in Crashlytics with the following error:
[firebase_messaging/apns-token-not-set] APNS token has not been received on the device yet. Please ensure the APNS token is available before calling getAPNSToken().We're currently using:
firebase_core: ">=4.10.0 <4.12.0"firebase_messaging: ">=16.3.0 <16.4.2"- Flutter SDK
3.41.6
Update #1: I haven't performed the migration related to the UISceneDelegate changes yet.
Reference: https://docs.flutter.dev/release/breaking-changes/uiscenedelegateHi all, I'm still unable to reproduce this on my end. Tested with both UIScene and non-UIScene enabled apps.
getAPNSToken()successfully resolved in both cases. Kindly share a minimal repo I can clone and run to investigate this further.Please try the following:
Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); // Comment this section to force reproduce the APNs error above. // if (Platform.isIOS) { // final settings = await FirebaseMessaging.instance.requestPermission(); // print('Settings registered = ${settings.authorizationStatus}'); // } final fcmToken = await FirebaseMessaging.instance.getToken(); print('FCM Token = $fcmToken'); runApp(const MyApp()); }
However, in the actual use case, even when
requestPermission()returnsauthorized, the APNs error above can still occur.@arlakay A full reproduction sample is a GitHub repo we can clone and test out without any modification, reproducing the issue. A code sample is not enough. Please share a full reproduction sample.
Reacted by Jude Selase Kwashie and Kaiwei Yangsee this PR : https://github.com/firebase/flutterfire/pull/11400/changes
it's mentioned on client.md
// For apple platforms, ensure the APNS token is available before making any FCM plugin API callsupdate 26 August,
- hope this help, check your mobile provision certificate, cause on my cases the provisioning status "invalid"
Same problem here
Reacted by Toni LeppänenconfigureNotificationCenterDelegate()only setsUNUserNotificationCenter.delegate; it never callsregisterForRemoteNotifications(), which still runs from launch/scene callbacks that have already fired. That is whygetAPNSToken()stays null.The example app can miss this: getToken() is invoked from a widget initState, after the first frame, and a prior run often leaves a cached APNs token, so a warm launch succeeds.
For testing purposes, I modified my code so that while
getAPNSTokenis null, I wait a second and make the request again until the value arrives. It never arrives.I don't know if it helps, but I inserted this code into my app, and I'm going to paste some results here.
static Future<void> fetchAPNSToken() async { if (Platform.isIOS) { String? token; int retries = 0; while (token == null && retries < 1000) { token = await FirebaseMessaging.instance.getAPNSToken(); if (token == null) { await Future.delayed(Duration(seconds: 2)); retries++; } } if (retries > 0) { FirebaseUtils.recordError( Exception("Final APNS Token: $token after $retries retries"), StackTrace.current, ); } } }Logs received by Firebase Crashlytics:
Final APNS Token: XXXXXX after 7 retries
Final APNS Token: XXXXXX after 5 retries
Final APNS Token: XXXXXX after 1 retries
Final APNS Token: XXXXXX after 199 retries
Final APNS Token: XXXXXX after 200 retries
Final APNS Token: null after 1000 retriesCan confirm that rolling back to 16.4.3 fixes it. This was a major production issue, new iOS users (and users for which the token expired) were unable to generate the token and thus excluded from the push notification system I have in place.
Hi all — thanks for the reports.
Credit to @tonileppanen for pinning this down:
configureNotificationCenterDelegate()only setsUNUserNotificationCenter.delegate. It never asks iOS for an APNs token. Registration still ran fromdidFinishLaunching/scene:willConnect, and under UIScene those callbacks can fire before the plugin exists, soregisterForRemoteNotifications()was never called andgetAPNSToken()stayed null.I’ve opened a PR to fix this: #18620:
Reacted by Wim, Ewerton José Wantroba, AlexPopaUpcode, teamTapir, Toni Leppänen and Leonardo Mogiano GutierrezHi all, I notice this warning from building in IOS. Not sure if this could play a part in contributing to the above issue
Conflicting return type in implementation of 'scene:willConnectToSession:options:': 'BOOL' (aka 'bool') vs 'void'
Happening together with firebase_messaging == 16.6.0diagnosis by AI:
This error occurs because you have implemented the scene:willConnectToSession:options: delegate method with a BOOL return type, but the official Apple Developer Documentation
- locked and limited conversation to collaborators
on Oct 7, 2026

Is there an existing issue for this?
Which plugins are affected?
Messaging
Which platforms are affected?
iOS
Description
After upgrading
firebase_messagingfrom 16.4.3 to 16.5.0, physical iOS devices running a UIScene-based Flutter app never receive the APNs device token, so FCM tokens can never be obtained and push notifications are completely broken.FirebaseMessaging.instance.getAPNSToken()returnsnullindefinitely (polled every 500ms for 3s, still null 11+ seconds after launch).FirebaseMessaging.instance.getToken()throws[firebase_messaging/apns-token-not-set] APNS token has not been received on the device yet.onTokenRefreshnever fires.aps-environmententitlement is present (development for debug, production for release); pushes to previously-obtained tokens still arrive, so certificates/entitlements are fine.This is a regression from 16.4.3: the identical app (same UIScene setup, same AppDelegate, same entitlements) ran in production alongside UIScene for five months on 16.4.3 with working push. The only change was the plugin upgrade to 16.5.0. Pinning back to 16.4.3 immediately restores APNs token delivery on the same device.
We did apply the new 16.5.0 UIScene guidance:
FLTFirebaseMessagingPlugin.configureNotificationCenterDelegate()is called inapplication(_:didFinishLaunchingWithOptions:)before returningsuper.... That fixes the notification-center delegate setup, but the APNs device token registration path (didRegisterForRemoteNotificationsWithDeviceToken→ FIRMessaging) still appears to be broken under scene-based lifecycle — the token never reaches the SDK.App setup:
Info.plistcontainsUIApplicationSceneManifestwithUISceneDelegateClassName = FlutterSceneDelegate(adopted 5 months ago, worked with 16.4.3).AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate(plugins registered indidInitializeImplicitFlutterEngine).FirebaseAppDelegateProxyEnabledkey; no manualdidRegisterForRemoteNotificationsforwarding).setAutoInitEnabled(true)is called explicitly at startup.Reproducing the issue
UIApplicationSceneManifest+FlutterSceneDelegate) andFlutterAppDelegate+FlutterImplicitEngineDelegate.firebase_messaging: 16.5.0, callFLTFirebaseMessagingPlugin.configureNotificationCenterDelegate()indidFinishLaunchingWithOptionsper the 16.5.0 README.getAPNSToken()(null forever) thengetToken()→ throwsapns-token-not-set.firebase_messagingto 16.4.3 (and remove the 16.5-only delegate call) → APNs token arrives,getToken()succeeds.Firebase Core version
4.x (Podfile.lock: Firebase iOS SDK 12.17.0)
Flutter Version
3.41.9 (stable)
Relevant Log Output
[firebase_messaging/apns-token-not-set] APNS token has not been received on the device yet. Please ensure the APNS token is available by calling `getAPNSToken()`.Additional context and comments
Workaround for anyone hitting this: pin
firebase_messaging: 16.4.3and remove/comment theconfigureNotificationCenterDelegate()call (16.5-only API).