Skip to content

[firebase_messaging]: FirebaseMessaging.instance.getInitialMessage() is always null on iOS after upgrade to 15.2.2 #17107

Open
@lukyanov

Description

@lukyanov

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Messaging

Which platforms are affected?

iOS

Description

await FirebaseMessaging.instance.getInitialMessage() is always null when the app is opened from the "killed" state.

The plugin version 15.1.6 (the previous version I used) worked as expected.

iOS 18.3.1

@pragma('vm:entry-point')
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
  await Firebase.initializeApp();
  RemoteMessage? initialMessage = await FirebaseMessaging.instance.getInitialMessage()
  // initialMessage is always null here
}

void main() async {
  FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
  ...
}

Reproducing the issue

  1. Close the app (swipe it away)
  2. Send a notification via firebase console or with a script (in my case I have a link attached to the notification data)
  3. Tap the notification
  4. Observe initialMessage being null

Firebase Core version

3.11.0

Flutter Version

3.27.2

Relevant Log Output

Flutter dependencies

No response

Additional context and comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocked: customer-responseWaiting for customer response, e.g. more information was requested.platform: iosIssues / PRs which are specifically for iOS.plugin: messagingtype: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions