Fixing “APNS token has not been set yet” in Firebase Messaging
Short answer: on Apple platforms, the Firebase Messaging SDK since iOS SDK 10.4.0 needs the APNs token from Apple before it can do anything else, and Google warns that the token isn’t guaranteed to have arrived by the time your code calls getToken(). Calling too early throws [firebase_messaging/apns-token-not-set]. Call FirebaseMessaging.instance.getAPNSToken() first and only request the FCM token once it isn’t null. If it never arrives, the setup is incomplete: push capabilities, the APNs key in Firebase, method swizzling, or a device that can’t receive pushes.
Checklist when the APNs token stays null
From Firebase’s FCM setup guides for Flutter and Apple platforms and Apple’s Xcode 14 release notes, read 1 October 2026.
| Check | What to look for |
|---|---|
| Order of calls | getAPNSToken() returns a value before getToken() or topic calls |
| Xcode capabilities | Push Notifications, plus Background fetch and Remote notifications background modes |
| APNs key in Firebase | A .p8 authentication key with key ID and team ID in the Cloud Messaging tab |
| Method swizzling | On for the Flutter plugin; FirebaseAppDelegateProxyEnabled not set to NO |
| Test device | A real device, or Simulator with iOS 16+ on macOS 13+ on an Apple silicon or T2 Mac |
Wait for the APNs token
getAPNSToken() and only goes on to FCM calls such as getToken() or subscribeToTopic() when the result isn’t null. In practice that means not calling getToken() straight from main() on app start: request permission first, check the APNs token, and if it is still null, try again later rather than letting the exception break startup. Listening to onTokenRefresh catches the FCM token once it becomes available.When the token never arrives
ios/Runner.xcworkspace and add Push Notifications, then the Background fetch and Remote notifications background modes. APNs key: in the Firebase console, open Settings > General, then the Cloud Messaging tab, and upload a .p8 APNs authentication key with its key ID and your Apple team ID, for development, production or both. Swizzling: the Flutter plugin needs method swizzling; if FirebaseAppDelegateProxyEnabled is set to NO in Info.plist, token handling won’t work. Native apps that turn swizzling off, and SwiftUI apps, must pass the APNs token to Firebase themselves in application(_:didRegisterForRemoteNotificationsWithDeviceToken:). Device: Simulator only gets remote notifications on iOS 16 or later, running on macOS 13 or later on an Apple silicon or T2 Mac, through the APNs sandbox.Keep the toolchain current
Where Censuus fits
Frequently asked questions
What does “APNS token has not been set yet” mean?
Firebase Messaging was asked for an FCM token or another API call before iOS delivered the APNs token. Since iOS SDK 10.4.0, the APNs token must be available first.
How do I fix apns-token-not-set in Flutter?
Request permission, call FirebaseMessaging.instance.getAPNSToken(), and only call getToken() when it returns a value. If it stays null, check push capabilities, the APNs key in Firebase and method swizzling.
Why does getAPNSToken() return null?
Usually because Apple hasn’t delivered it yet, or because push isn’t set up: missing Push Notifications capability or background modes, no APNs key uploaded to Firebase, swizzling disabled, or a simulator that can’t receive remote notifications.
Can I get an APNs token on the iOS Simulator?
Yes, on iOS 16 or later running on macOS 13 or later on a Mac with Apple silicon or a T2 chip. The simulator uses the APNs sandbox.
Do I need method swizzling for firebase_messaging?
Yes. Firebase says the Flutter plugin requires method swizzling on Apple devices, and without it FCM token handling won’t work.
Guides for app developers
- How to market an app: a stage-by-stage plan
- Submit your app for free
- How to get your app to show up in Google search
- How to get your app recommended by AI assistants
- Free app promotion sites, checked for dofollow
- App store optimization checklist: what Apple and Google actually say
- App launch checklist: iOS and Android, step by step
- How to find beta testers for your app
- How to get more app reviews without breaking the store rules
- How to get your app featured on the App Store and Google Play
- App Store and Google Play screenshot sizes: what you must upload
- How to promote an app on Google Play with Play Console’s own tools
- How to promote an iOS app with App Store Connect’s own tools
- App Store keywords: how to fill the 100-character field
- How to market a fitness app: what Apple and Google let you claim
- How to market a kids app: the store rules that shape it
- How to market a finance app: the store rules to know first
- How to market a dating app: the store rules that shape it
- How to market a subscription app: what the stores require of your offer
- How to market a mobile game: the store rules that shape it
- Apple Ads MCP: connect an AI assistant to your campaigns
- How to promote an app on TikTok with creators
- How to promote an app on YouTube with creators
- How to market a VPN app: the store rules to know first
- How to market an AI app: the store rules that shape it
- How to market an education app: schools, parents and learners
- How to localize your App Store and Google Play listing
- Android vitals and Google Play visibility: the thresholds that hide apps
- App Store and Google Play age ratings: what drives them
- App Store privacy labels and Google Play Data safety: what to declare
- Common App Store rejection reasons and how to avoid them
- How to get the first users for your app
- App preview video specs: App Store sizes, length and rules, and the Google Play video
- App Store custom product pages, and the Google Play version
- App icon size for the App Store and Google Play
- App Store phased release and Google Play staged rollouts
- App Store subtitle and promotional text: limits and how to use them
- Google Play feature graphic: size, placement and rules
- TestFlight public link: set it up, limit it, and fix it when it does not work
- App Store promo codes and offer codes: how they work and their limits
- App Store A/B testing: product page optimization and Google Play experiments
- App Store in-app events: limits, badges and media sizes
- App Store Connect analytics: what each metric means
- Google Play store listing reports: clicks, CTR and the 2026 changes
- Google Play target API level requirements for 2026
- Android developer verification: what changed on September 30, 2026
- App Store and Google Play fees in 2026
- Google Play’s 12 testers for 14 days rule, explained
- How to transfer an app to another developer account
- How to remove an app from the App Store and Google Play
- The app account deletion requirement on the App Store and Google Play
- Google Play 16 KB page size requirement: dates, checks and fixes
- Declared Age Range and Play Age Signals: age assurance APIs for app developers
- Xcode 26 and the iOS 26 SDK requirement for App Store Connect
- The iOS privacy manifest: what to declare and how
- Accessibility Nutrition Labels: what to declare on your App Store page
- Google Play’s photo and video permissions policy, explained
- Google Play Billing Library version requirement: what you need to ship now
- App Tracking Transparency: when to ask and how
- App Store Connect API key: create it, store it, use it
- How to submit an In-App Purchase for review
- The Play Integrity API: what it checks and how to use it
- How long app review takes on the App Store and Google Play
- Google Play policy updates in 2026, with the deadlines
- Rosetta 2 end of support: what Mac developers need to do
- Monthly subscriptions with a 12-month commitment on the App Store
- Subscription Bundles, Suites and multiseat purchases on the App Store
- Sign in with Apple private relay email and the new private.icloud.com domain
- App Store Server Notifications V2: switching from V1 and handling every event
- Migrating to StoreKit 2: what is deprecated and what replaces it
- App Store creative assets: headers and search result visuals in iOS 27
- On-Demand Resources is deprecated: moving to Background Assets
- Time Allowances in iOS 27: how your app gets its category
- Android Contact Picker and the new READ_CONTACTS rules
- The Android 17 location button and Google Play’s precise location rules
- Phone verification without READ_CALL_LOG: what replaces call-based checks
- Apple’s EU business terms from October 1, 2026
- Android 17 app memory limits: detect, test and stay under them
- The Android 17 local network permission
- Android 17 background audio hardening
- Cleartext HTTP and certificate transparency on Android 17
- Android 17: lock-free MessageQueue and static final fields
- Android 17 ignores orientation lock and resizability on large screens
- Android 17 behavior changes: a checklist for target SDK 37
- Preparing your app for iPhone Duo
- Google Play subscription grace period and account hold
- Getting your Android app ready for Googlebook
- The Android 17 Handoff API
- ADB Wi-Fi 2.0 wireless debugging
- Android AppFunctions: your app as on-device tools for AI agents
- Android Live Updates: how to qualify for a promoted notification
- App Store Connect webhooks
- Apple Foundation Models: on-device vs Private Cloud Compute
- Using Claude, Codex and other agents in Android Studio
- Gemini Nano for Android developers
- Firebase AI Logic: the App Check deadline and Gemini 2.5 shutdowns
- Swift 6.4: what’s new for app developers
- The Swift SDK for Android
- Publishing your game on Android Auto and Android Automotive OS
- Liquid Glass in a Compose Multiplatform app
- Expo SDK 58: when it ships and what changes
- Device Hub in Xcode 27
- Using the Xcode MCP server with Claude Code, Codex and other agents
- Xcode 27: release, requirements and point releases
- Gemma 4 and Android skills in Android Studio
- The UIScene life cycle is required in iOS 27
- Migrating to Android Gradle plugin 9
- Navigation 3 for Jetpack Compose
- Kotlin 2.4, 2.4.20 and the road to 2.5
- Upgrading your app build to Gradle 9
- The latest Compose BOM and Compose 1.12
- Compose Multiplatform 1.12 and the Hot Reload MCP server
- Opting out of Liquid Glass with UIDesignRequiresCompatibility
- Flutter 3.47 and the latest stable version
- React Native 0.87 and the latest version
- Android Studio Quail 4 and what comes next
- CocoaPods goes read-only: what changes and when
- Fixing YouTube Error 153 in embedded players
- Older iOS Simulator runtimes and Rosetta destinations in Xcode
- Fixing the fmt consteval error in React Native on Xcode 26.4
Put your app in the ranking
Censuus ranks apps by the visits they draw and by sponsorship, no bots. Listing is free; sponsorship raises placement.