fix(messaging,ios): register for APNs after Dart Firebase.initializeApp() - #18650
fix(messaging,ios): register for APNs after Dart Firebase.initializeApp()#18650SelaseKay wants to merge 2 commits into
Conversation
…pp() When Firebase is initialized from Dart without a bundled GoogleService-Info.plist, FIRApp does not exist at launch so isAutoInitEnabled reads as NO and APNs registration is skipped. Re-run the auto-init check once the default app is configured, and keep temporary APNS-REG logs so reporters can confirm registration is requested.
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
Description
firebase_messaging16.5.0+ skipsregisterForRemoteNotificationsat launch when Firebase is initialized from Dart only (noGoogleService-Info.plistin the iOS app bundle, no nativeFirebaseApp.configure()).isAutoInitEnabledis read indidFinishLaunching, before DartinitializeApp(). Without a bundled plist,[FIRMessaging messaging]is nil, the gate reads asNO, and APNs registration never happens. Result:getAPNSToken()staysnull,getToken()throwsapns-token-not-set, andonTokenRefreshnever fires.This PR re-runs the auto-init check from
pluginConstantsForFIRApp:afterfirebase_corehas configured the default app. Launch-time registration is unchanged for apps that still bundle a plist.FirebaseMessagingAutoInitEnabled = NOis still honored (no registration untilsetAutoInitEnabled(true)).Related Issues
Fixes #18643
Checklist
///).melos run analyze) does not report any problems on my PR.Breaking Change
Test plan
GoogleService-Info.plistin Copy Bundle Resources).getAPNSToken()is non-null andgetToken()succeeds withoutapns-token-not-set.GoogleService-Info.plistcontinue to register at launch.FirebaseMessagingAutoInitEnabled = NOstill skips registration untilsetAutoInitEnabled(true).