-
Notifications
You must be signed in to change notification settings - Fork 4k
🐛 [firebase_messaging] iOS Notifications not received in 8.0.0-dev.8 #4097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello! |
I can't reproduce this with just the official example on flutter doctor -v
Everything works fine on both Android and iOS. From the sounds of it it could be an Xcode config issue. The official steps for configuring the Xcode project and APN is at FCM via APNs Integration. Have you followed these steps? I wouldn't expect notifications to work without this. |
@markusaksli-nc I followed the configuration steps carefully, and as mentioned in the bug report iOS notifications were working great in version After migrating to Firebase reports success when sending a notification. If there's a problem it typically responds with failure and a reason e.g. "not registered", "authentication error", etc. Can you confirm that it all works on Flutter |
It works on stable as well for me. If the notifications reach the device but the callbacks are not triggered, could you try to see if there is any useful output with |
Thank you for testing on I needed a sanity check to ensure that something on the Apple/Firebase side hadn't changed or gone foul, so I went back to using package I don't have a Mac with XCode, and so cannot get closer to the internal logs or output. What I did was embed debug code everywhere to emit trace information to a REST API for logging. The trace tells me that either the device isn't receiving notifications (unlikely, because using I see everything initialize OK and without error. Both devices register with Firebase, because the notification sends OK. If the device didn't register, the error message in the response is Something's gone a bit wack somewhere on the iOS side I think, that isn't causing a problem in your canonical example. I'm unclear as to whether the delegate assignment in Perhaps the previous issue with co-existing with other plugins e.g. I don't really know what to try next. |
Have the same problem on iOS |
On my side its not working when including the |
Everyone, please share the iOS version running on your phones. I believe this issue may be iOS version-specific. In #4096 it's working on 14.2. From what I have read, The documentation for |
@paynekw I was using iOS 14.1, now updating to iOS 14.2. I will do testing and return back with results. |
same as @den-ree I might wait for Xcode 12.2 official release though. @paynekw I normally use I mentioned about
So I was seeing how the last line was working but skipped when I included |
Same problem here, on iOS 14.2 I cannot receive the notifications at all. |
I'm on iOS 13.5.2, push notifications with
anything wrong? |
I updated to iOS 14.2 on my physical and Xcode to 12.2, and prefromed a fresh install but notifications still work as expected with the official example on
flutter doctor -v
I'm going to label this issue anyway due to the amount of comments but everybody please make sure you have followed FCM via APNs Integration closely. |
@markusaksli-nc did you try with |
@diegoveloper Works for me Payload
|
@markusaksli-nc ah wait, btw I'm talking about |
It isn't wrong since it is the name of the APN payload parameter, that guide is more for the dart code usage of the flutter plugin. I'd refer to the official FCM HTTP Ref for sending notifications through FCM.
|
@markusaksli-nc okay, did you try |
|
I'm releasing a build today and will report findings using |
Heres what I tested out for
btw, firebase.flutter.dev docs are incorrect in this example
it is not so if you're trying with contentAvailable, you are receiving a normal notification and that's why its working |
I'm afraid to say that iOS is still completely dead for me on |
I have a few things on my mind.
Questions:
AFAIK there's no way to upload a TL;DR
I'd like to see this tested being built in the Cloud and not just locally. EDIT: I never receive |
This is not correct. |
The .p8 is for server code and is not for Xcode and has no direct relation to the entitlements / profile for Xcode in this context. Specifying the Team ID on the Firebase Console when uploading the .p8 is how the two can be connected. The Firebase Console/backend can read provisioned profiles/app ids from an Apple API using the .p8 and based on your Firebase iOS Bundle Identifier (defined when creating your iOS app on the Firebase Console) pair this up with a provisioning profile that has the APNs entitlement where the App Id matches the Bundle ID. |
@diegogarciar were you able to get |
@aytunch no, it seems that is still not being called when using |
@diegogarciar thanks for the quick response. I understand that the problem is being caused by the native iOS code. Not from the Flutter side. However in my case I am sending a |
@aytunch onBackgroundMessage is sent to flutter only from that iOS function, so if that function is not working, it will fail for all message types. PD: I'm also using Data&Notification message. |
It works for me, thanks. |
I am not receiving push notifications on my iOS simulators. starting from 8.x.x Why is this changed in the new version? After some testing I saw that my apns token was null on a simulator and not null on a real device. How is it possible that I received notification in the old version but not in the new release? Right now I am using 8.0.0-dev.11 |
@vanlooverenkoen I believe the root cause was discovered in #4388, and we're now waiting on #4412. I seem to recall reading in the documentation that notifications don't work in simulator by default. There may be a way to test notifications in simulator, but I believe the default behavior is that they don't - a physical device is required. |
@paynekw a physical device is indeed required if the app is killed so the notifications are shown in the notification tray. On 7.0.3 we were able to develop our app in the simulator with the notification updates. But only while the app was open. (as expected). If I switch back to version 7.0.3 the notifications still work. but we are required to upgrade to 8.x.x because of the v2 embedding for android. So you can already see the problem. We cannot use v1 because we need the functionality of v2 for another part of our app. I saw that issue as well. But I am not using firebase_auth. We are only using firebase_core & firebase_messaging. |
@vanlooverenkoen in that case, I'm sorry I can't answer your specific question. There appear to be many having a variety of issues in various situations with 8.x. I myself have been unable to receive notifications since the beginning of November. |
I managed to solve this issue that was affected by the auth package. I am not having problems so far after this change |
Yes correct as v7 used a now deprecated & removed feature from the underlying Firebase iOS SDK for messaging - a direct channel connection. The old Firebase iOS SDK could establish a direct connection to the FCM backend and receive messages bypassing the need for APNs whilst the app was open. This feature no longer exists, everything MUST now go through APNs - so you need to ensure you've set it up correctly. I can't speak as to why it was removed but from my experience it's probably for the best, now you must setup APNs and if you don't do it correctly then you won't get any notifications, rather than the possibly confusing 'it works in the foreground but not in the background' issues (there's so many of these issues that have been made on FlutterFire and also over at React Native Firebase). |
I don't know whether #4657 fixed everyone else's problems, but after updating packages and dependencies, following this migration guide, revisiting all setup & configuration instructions, examining change logs etc., iOS is still completely dead for me. Test notifications from Firebase Console aren't received on iOS, and the (legacy) REST endpoint continues to report success with no delivery to the device. I give up. Am going to find an alternative to FCM because this has been a nightmare. Thank you to the maintainers and the community who have been helpful. |
@paynekw if you’re receiving on android but not on iOS then its an iOS problem, not fcm. Changing product wont fix it unless you configure it correctly. Try sending notifications with the apns server itself first, once it works, check if with fcm works too |
@diegogarciar agree wholeheartedly, thanks for the sound advice. Understand my frustration at this point... |
We had a problem where our implemetation was working on android but not on iOS. Turns out that the php package we were using was causing the issue. We removed the php package at backend side. And we are now using the rest api directly. @paynekw maybe you have a similar issue? |
Bug report
Describe the bug
After upgrading to
8.0.0-dev.8
from7.0.3
, iOS does not receive/respond to push notifications i.e. no handlers or events fire. With7.0.3
, foreground notifications were working but not background notifications, which is the reason for upgrading to8.x
.Android is fine whether in foreground or background, or terminated. Trace information from iOS shows that initialization succeeds without error. The iOS trace is the same as that from Android and shows no irregularities. iOS Requests permission, which I grant. Settings reports that all permissions are granted as expected.
I'm using an iPhone 6 physical device running iOS
12.4.9
and theflutter_local_notifications
plugin.APNs
is configured with a.p8
Authentication Key. When I send a notification viaFCM
to the iPhone, the response reports success withsuccess: 1, failure: 0
and a validmessage_id
.Steps to reproduce
Steps to reproduce the behavior:
firebase_messaging: ^8.0.0-dev.8
plugin as per documentation and examples.FCM
.Expected behavior
One of [
FirebaseMessaging.onMessage
,FirebaseMessaging.onBackgroundMessage
,FirebaseMessaging.onMessageOpenedApp
] should fire. I've added trace information to each handler and it appears that they are never invoked on iOS. As mentioned earlier, all work as expected in Android.Additional context
AppDelegate.swift
includes:Info.plist
includes:I have tried various things to enable/disable method swizzling and also with/without the entry in
info.plist
. The setting appears to have no effect.project.pbxproj
includes:I believe I do not require an
entitlements
file withCODE_SIGN_ENTITLEMENTS
pointing to it to specify theaps-environment
, becauseFCM
is configured with a.p8
key and not environment-specific certificates.Sending notifications
I have tried with/without and all possible values for
priority
andcontent-available
when sending the notification viaFCM
without any observable change in behavior.Flutter doctor
Run
flutter doctor
and paste the output below:Click To Expand
I run multiple versions of Android Studio side-by-side, so ignore the incorrect warnings about the Dart and Flutter plugins not being installed in 4.x (they most certainly are.)
Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
The frustrating part is that I do not have XCode or a Mac. Each cloud build takes around 20 minutes, and costs money. I haven't ruled out the possibility of the XCode project configuration being slightly incomplete/incorrect due to not having access to XCode, however I have tried everything I can think of, and have run out of resources providing hints as to what the problem might be.
So far, two full days have been spent trying to get this to work.
The text was updated successfully, but these errors were encountered: