flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

[firebase_messaging] iOS 13 push notification NOT working

Open kroikie opened this issue 7 years ago • 264 comments

Push notification does not seem to work on iOS 13 device nor on my iOS 12.4.1 device on stable 1.9.1. Seems to be 2 separate issues as well.

  1. in Flutter Stable 1.9.1, push notifications do not appear on my iOS 12.4.1 device, when the always worked before on older flutter versions.
  2. iOS 13 device does not receive push notifications at all

Some reading available from oneSignal https://onesignal.com/blog/ios-13-introduces-4-breaking-changes-to-notifications/

I updated my device OS(personal) version to 13, cannot further test without downgrading it back to 12.4.1. and I do not have a spare iPhone available.

Thank you

Also for other users, can you please input our own issue related to the mentioned. Things such as current physical device iOS software version and flutter channel along with its version number. so we can compile a list of where in flutter and iOS(versions) things just stopped working.

Push notification is and should be very ### critical part of a persons or companies application when used right. I hope we can address the issues and come up with a solution.

kroikie avatar Oct 13 '19 19:10 kroikie

@khainhero

The issue at https://github.com/flutter/flutter/issues/41180 has been closed and moved here. Future collaboration on this issue will be done here.

kroikie avatar Oct 13 '19 19:10 kroikie

i got same issue ,,, notification only work in foreground,,,, in background not working... there is no notification in tray..

digarahayu avatar Oct 23 '19 10:10 digarahayu

@kroikie did this problem occur because of Channel stable, v1.9.1+hotfix.5 ?? because #41180 is saw there is people don't get this issue on Flutter (Channel master, v1.10.6-pre.29)

digarahayu avatar Oct 23 '19 11:10 digarahayu

I can confirm this. Notifications are working fine on Android but on iOS all messages are only working in foreground like data messages. They are sent to "onMessage" but in the background nothing happens. When the app is opened again, the missing notifications are sent to "onMessage".

The intention of "notification messages" was to pop them up even when the app is in background or terminated. That doesn't seem to work in iOS at the moment.

krille-chan avatar Oct 29 '19 10:10 krille-chan

Make sure info.plist is configured

<key>FirebaseScreenReportingEnabled</key>
<true/>
<key>FirebaseAppDelegateProxyEnabled</key>
<true/>

telinx avatar Oct 31 '19 03:10 telinx

I'm using flutter stable v1.9.1 and master v1.10.6 and it seems not working at all on ios 13 or 12.4. and yes in android it's working normal.

dopefaceee avatar Oct 31 '19 05:10 dopefaceee

Not working in android pie up to (emulator)

digarahayu avatar Oct 31 '19 11:10 digarahayu

I am having this issue on iOS13 as well.

njovy avatar Nov 04 '19 20:11 njovy

I have the same issue as well on iOS 13.

kitmoovup avatar Nov 06 '19 09:11 kitmoovup

Update: I've solved the problem with some changes:

  1. FirebaseAppDelegateProxyEnabled from bool NO to string NO
  2. I change my flavor setting with following this link https://medium.com/@matt.goodson.business/separating-build-environment-configurations-in-flutter-with-firebase-doing-it-the-right-way-c72c3ad3621f.
  3. Adding pod 'Firebase/Messaging' to Podfile

Now from console, Push notification had appeared again.

dopefaceee avatar Nov 08 '19 08:11 dopefaceee

FYI, I've created a simple Flutter app (1.9.1+hotfix.6) with firebase_messaging, and it works as expected on both Android and iOS 13, while the app is in the foreground or the background or killed. I didn't do anything special, besides following the regular steps in the README.

nashfive avatar Nov 08 '19 08:11 nashfive

  1. FirebaseAppDelegateProxyEnabled

@dopefaceee , can you please explain more on your solution? I don't quite understand what exactly you did for each of steps. Where FirebaseAppDelegateProxyEnabled is located? Why you added pod to Podfile if it's managed by pubspec? What exactly was changed in regards of flavoring?

AlexBacich avatar Nov 08 '19 19:11 AlexBacich

FYI, I've created a simple Flutter app (1.9.1+hotfix.6) with firebase_messaging, and it works as expected on both Android and iOS 13, while the app is in the foreground or the background or killed. I didn't do anything special, besides following the regular steps in the README.

It does not work for me...

ThinkSimple avatar Nov 08 '19 20:11 ThinkSimple

@AlexBacich add FirebaseAppDelegateProxyEnabled to your Info.plist. I add podfile for configuring FIRApp on my AppDelegate.m, so I have to add : @import Firebase; and [FIRApp configure]; before GeneratedPluginRegistrant. Don't forget to turn on Background Modes and check background fetch, remote notifications.

dopefaceee avatar Nov 09 '19 12:11 dopefaceee

FYI, I've created a simple Flutter app (1.9.1+hotfix.6) with firebase_messaging, and it works as expected on both Android and iOS 13, while the app is in the foreground or the background or killed. I didn't do anything special, besides following the regular steps in the README.

Surprisingly, at some point push notifications DID START coming properly. I was able to get normal notifications in background. And then again they STOPPED coming today.

Weird thing about this - how messages are coming. Today format is something like this:

{
  "from": "441854012104",
  "id": "2",
  "notification": {
    "title": "this    is    a    title",
    "body": "this is body"
  },
  "type": "news",
  "click_action": "FLUTTER_NOTIFICATION_CLICK"
}

Yesterday same push (same CURL for sending) had different format:

{
  "from": "441854012104",
  "aps": {
    "alert": {
      "title": "this    is    a    title",
      "body": "this is body"
    }
  },
  "data": {
    "type": "news",
    "id": "2",
    "click_action": "FLUTTER_NOTIFICATION_CLICK"
  }
}

I just don't get it. It's so random.

AlexBacich avatar Nov 12 '19 12:11 AlexBacich

@AlexBacich what you're describing seems to be simply the difference between an Android FCM message and an iOS push : FCM messages iOS Push payload

nashfive avatar Nov 12 '19 15:11 nashfive

@nashfive ok, let's take into consideration it's the difference between an Android FCM and iOS Push. But how can I control it? I'm sending exactly the same test request to legacy FCM API and get different message format on my device. I don't believe in conspirancy but it seems sometimes FCM is sending requests in different format.

AlexBacich avatar Nov 12 '19 19:11 AlexBacich

@AlexBacich hehe... sorry, I don't know why you get different payload then :( Do you have the same problem when sending test push notifications from Firebase Messaging with a given token ?

nashfive avatar Nov 13 '19 13:11 nashfive

@nashfive yes, problem is exactly when sending with specific push token.

AlexBacich avatar Nov 14 '19 08:11 AlexBacich

Is there any workaround for this issue?

OsamaFelFel avatar Nov 15 '19 21:11 OsamaFelFel