Solvedflutterfire Firebase messaging onResume and onMessage broken on iOS since Flutter 1.7.4

On Flutter's dev channel (and all other channels), Firebase Messaging's onResume and onMessage callbacks are broken on iOS as of 1.7.4. We have done extensive testing, and it works fine with v1.6.3, and even v1.6.7. onLaunch works fine, and all callbacks work fine on Android. The callbacks are not called at all, and the following error can be found in the iOS logs:

SpringBoard(UserNotificationsServer)[52] <Notice>: [com.ourapp.someapp] Application foreground
launch action for notification response action com.apple.UNNotificationDefaultActionIdentifier
recieved action response <BSActionResponse: 0x2839cde00; error:
<NSError: 0x2834c37e0; domain: BSActionErrorDomain; code: 4> {
    description = "The operation couldn\M-b\M^@\M^Yt be completed. (BSActionErrorDomain error 4.)";
}>

Every now and then it shows error 1 instead of error 4. This error is terribly documented online (not at all), but I recognise it from when we had our iOS app configurated wrong for push notifications. Our configuration is fine now. We build via a build server, so we still have all the logs. We built a version on June 20st (from now on referred to as A), and a version on June 21st (B). A was v1.6.3, B was v1.7.4. We've since tested v1.6.7, and that version is fine too. Version A calls the callbacks and works fine. Version B does not. The issue is not related to our code since on our current HEAD, the callbacks still only work < v1.7.4.

Now, we have had to revert back to Flutter v1.6.7, meaning we no longer have access to app bundles and TransferableTypedData, which is, of course, a major blocker for our work.

Flutter version for A:

Flutter 1.6.3 • channel beta • https://github.com/flutter/flutter.git
Framework • revision bc7bc94083 (4 weeks ago) • 2019-05-23 10:29:07 -0700
Engine • revision 8dc3a4cde2
Tools • Dart 2.3.2 (build 2.3.2-dev.0.0 e3edfd36b2)

Flutter version for B:

Flutter 1.7.4 • channel dev • https://github.com/flutter/flutter.git
Framework • revision dfecafa4ab (7 days ago) • 2019-06-14 09:46:23 -0700
Engine • revision 2589785b5c
Tools • Dart 2.4.0

Firebase messaging version: 5.1.0, but applies to every version since at least 5.0.1 (that's as far as we went)

30 Answers

✔️Accepted Answer

everybody: What would be possible other implications when removing that code?

Removing those lines make it work for me. Though as @cascoid says adding those lines fixed my app notifications when I used 6.0.3, before adding those lines I did not receive any notifications at all...

To summerise:
Removing the following it now works:

if #available(iOS 10.0, *) {
  UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}

I am running:

  • Firebase messaging 6.0.9
  • iOS 13.3 and iOS 12.4.4
  • Flutter 1.12.13+hotfix.5

Other Answers:

@kroikie I thought this issue is fixed with adding below but I don't get any callbacks after update to 1.12.13+hotfix.6. This should be reopened.

if #available(iOS 10.0, *) {
  UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}

@kroikie Is there any additional steps that should be performed to fix this (besides ones from package page)?

I'm still having this issue - data message are consumed as expected, but notification messages are ignored by onMessage (or any other callback) if app is in foreground. They are displayed normally in notification tray if app is in background, but callbacks are not fired if tapped.

I'm using firebase_messaging 6.0.1 and flutter 1.12.13+hotfix.1 from beta channel. (Although I've tried plugin version straight from github with same result)

More Issues: