Skip to content

[firebase_messaging]: Notification click if app is terminated leads to blank screen on launched app #17230

Open
@steffenhaak

Description

@steffenhaak

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Messaging

Which platforms are affected?

macOS

Description

Whenever a firebase remote notification is received with the app not running, the notification is shown in the notification center. Once the user clicks on the received notification.

Expected: the app starts normally and the message will be available in app by calling FirebaseMessaging.instance.getInitialMessage()

Actual: the app only shows a blank screen with the following error in the logs:

Image

Reproducing the issue

Receive an remote notification an a MacOS flutter app with firebase_messaging correctly enabled while the app is terminated. Click on the notification element in MacOS. The app starts but stays blank (black screen).

Firebase Core version

3.12.1

Flutter Version

3.29.2

Relevant Log Output

0   CoreFoundation                      0x000000018ba92e80 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x000000018b57acd8 objc_exception_throw + 88
	2   CoreFoundation                      0x000000018bb481d8 -[NSObject(NSObject) __retain_OA] + 0
	3   CoreFoundation                      0x000000018b9ff830 ___forwarding___ + 1568
	4   CoreFoundation                      0x000000018b9ff150 _CF_forwarding_prep_0 + 96
	5   FLUTTER.debug.dylib            0x000000010494026c +[FLTFirebaseMessagingPlugin remoteMessageUserInfoToDict:] + 180
	6   FLUTTER.debug.dylib            0x000000010493cd50 -[FLTFirebaseMessagingPlugin application_onDidFinishLaunchingNotification:] + 152
	7   CoreFoundation                      0x000000018ba15370 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
	8   CoreFoundation                      0x000000018baa620c ___CFXRegistrationPost_block_invoke + 88
	9   CoreFoundation                      0x000000018baa6154 _CFXRegistrationPost + 436
	10  CoreFoundation                      0x000000018b9e3fac _CFXNotificationPost + 732
	11  Foundation                          0x000000018cb9e6b8 -[NSNotificationCenter postNotificationName:object:userInfo:] + 88
	12  AppKit                              0x000000018f59f48c -[NSApplication _postDidFinishNotification] + 284
	13  AppKit                              0x000000018f59f23c -[NSApplication _sendFinishLaunchingNotification] + 172
	14  AppKit                              0x000000018f59d69c -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 500
	15  AppKit                              0x000000018f59d2a4 -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 488
	16  Foundation                          0x000000018cbc74ac -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 316
	17  Foundation                          0x000000018cbc72a4 _NSAppleEventManagerGenericHandler + 80
	18  AE                                  0x0000000192fbf134 _AppleEventsCheckInAppWithBlock + 13904
	19  AE                                  0x0000000192fbea58 _AppleEventsCheckInAppWithBlock + 12148
	20  AE                                  0x0000000192fb7fa4 aeProcessAppleEvent + 488
	21  HIToolbox                           0x0000000196eab210 AEProcessAppleEvent + 68
	22  AppKit                              0x000000018f596b40 _DPSNextEvent + 1420
	23  AppKit                              0x000000018fefcc24 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688
	24  AppKit                              0x000000018f589874 -[NSApplication run] + 480
	25  AppKit                              0x000000018f560068 NSApplicationMain + 888
	26  FLUTTER.debug.dylib            0x0000000104931888 $sSo21NSApplicationDelegateP6AppKitE4mainyyFZ + 40
	27  FLUTTER.debug.dylib            0x0000000104931850 $s12FLUTTER11AppDelegateC5$mainyyFZ + 44
	28  FLUTTER.debug.dylib            0x00000001049318f0 __debug_main_executable_dylib_entry_point + 28
	29  dyld                                0x000000018b5b8274 start + 2840

Flutter dependencies

Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.

Additional context and comments

I already located the bug and will submit a PR that fixes the error shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions