Skip to content

🐛 [firebase_messaging] - iOS notifications are not displayed #4437

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

Closed
tsahnarExp opened this issue Dec 19, 2020 · 12 comments
Closed

🐛 [firebase_messaging] - iOS notifications are not displayed #4437

tsahnarExp opened this issue Dec 19, 2020 · 12 comments
Labels
Needs Attention This issue needs maintainer attention. type: bug Something isn't working

Comments

@tsahnarExp
Copy link

tsahnarExp commented Dec 19, 2020

Hi,

I upgraded the flutter version of app to the latest (1.22.5), since then notifications are not displayed. I can see in the logs that the onMessage callback is being called and the notification data is being sent - testing via the firebase console.

This the output from flutter doctor:

[✓] Flutter (Channel stable, 1.22.5, on Mac OS X 10.15.6 19G73 darwin-x64, locale en-IL)
    • Flutter version 1.22.5 at /Users/****/Desktop/Dev/tools/flutter
    • Framework revision 7891006299 (9 days ago), 2020-12-10 11:54:40 -0800
    • Engine revision ae90085a84
    • Dart version 2.10.4

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/****/Library/Android/sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.3, Build version 12C33
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 43.0.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] IntelliJ IDEA Ultimate Edition (version 2020.1.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 47.1.3
    • Dart plugin version 201.8538.45

[✓] IntelliJ IDEA Community Edition (version 2019.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 43.0.3
    • Dart plugin version 193.6015.53

[✓] VS Code (version 1.52.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.16.0

[✓] Connected device (2 available)
    • sdk gphone x86 arm (mobile) • emulator-5554                        • android-x86 • Android 10 (API 29) (emulator)
    • iPhone 12 (mobile)          • AEB05F91-087A-4EE1-8472-DB3DAD672C71 • ios         • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)

I know that sometimes in simulator it does not work, so I always try on real device.
I upgraded to firebase messaging latest version and using ^7.0.3.
In the version before upgrading (v1.17.0) when installing the build on device I do see the notifications.

I'll be happy to provide more info
thanks

@tsahnarExp tsahnarExp added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Dec 19, 2020
@markusaksli-nc
Copy link
Contributor

Hi @tsahnarExp
Can you reproduce this behavior with the official example? Could you please provide your flutter pub deps -- --style=compact?
Thank you

@markusaksli-nc markusaksli-nc added blocked: customer-response Waiting for customer response, e.g. more information was requested. impact: deprecated-version This bug exists only in an older version and is no longer present in later releases. and removed Needs Attention This issue needs maintainer attention. labels Dec 21, 2020
@acoutts
Copy link

acoutts commented Dec 21, 2020

I'm seeing some weird behavior on this too.

Immediately after upgrading, some of my PN work and some don't. Sometimes they end up in the onMessage handler and some just show a flutter print statement of the notification payload without calling onMessage.

@tsahnarExp
Copy link
Author

tsahnarExp commented Dec 21, 2020

Hi @tsahnarExp
Can you reproduce this behavior with the official example? Could you please provide your flutter pub deps -- --style=compact?
Thank you

Here is the output of flutter pub deps:

Dart SDK 2.10.4
Flutter SDK 1.22.5

dependencies:
- auto_route 0.6.9 [flutter meta]
- awesome_card 1.1.0 [flutter]
- cached_network_image 2.4.1 [flutter flutter_cache_manager octo_image]
- copy_with_extension 1.4.0
- cupertino_icons 0.1.3
- dartz 0.9.2
- device_info 0.4.2+10 [flutter device_info_platform_interface]
- dio 3.0.10 [http_parser path]
- division 0.8.8 [flutter]
- dotted_border 1.0.7 [flutter path_drawing]
- enum_to_string 1.0.14
- equatable 1.2.5 [collection meta]
- eventsource 0.2.3 [collection http http_parser logging sync]
- expandable 4.1.4 [flutter]
- firebase_core 0.5.3 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
- firebase_crashlytics 0.2.4 [flutter stack_trace firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface]
- firebase_messaging 7.0.3 [meta flutter firebase_core]
- flushbar 1.10.4 [flutter]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_bloc 4.0.1 [flutter bloc provider]
- flutter_facebook_login 3.0.0 [flutter collection]
- flutter_form_builder 3.14.1 [flutter flutter_typeahead intl flutter_chips_input datetime_picker_formfield flutter_colorpicker signature validators date_range_picker flutter_touch_spin image_picker image_picker_for_web rating_bar country_pickers phone_number]
- flutter_localizations 0.0.0 [flutter intl characters collection meta path typed_data vector_math]
- flutter_secure_storage 3.3.5 [meta flutter]
- flutter_svg 0.18.1 [path_drawing xml vector_math meta flutter]
- geolocator 5.3.2+2 [flutter meta equatable google_api_availability location_permissions vector_math]
- get 2.14.1 [flutter]
- get_it 5.0.3 [async meta]
- google_fonts 1.1.1 [flutter http path_provider crypto pedantic]
- http 0.12.2 [http_parser path pedantic]
- intl 0.16.1 [path]
- introduction_screen 1.0.9 [flutter dots_indicator]
- json_serializable 3.5.1 [analyzer build build_config json_annotation meta path source_gen]
- logger 0.9.4
- lottie 0.4.1 [flutter archive characters charcode collection logging meta path vector_math]
- modal_bottom_sheet 0.1.6+1 [flutter]
- modal_progress_hud 0.1.3 [flutter]
- package_info 0.4.3+2 [flutter]
- permission_handler 5.0.1+1 [flutter meta permission_handler_platform_interface]
- pin_code_fields 3.1.2 [flutter]
- provider 4.3.2+3 [collection flutter nested]
- retrofit 1.3.4+1 [meta dio]
- rxdart 0.24.1
- shared_preferences 0.5.12+4 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web shared_preferences_windows]
- stacked 1.7.7 [flutter provider observable_ish]
- stacked_services 0.4.4+2 [flutter get injectable]
- stripe_payment 1.0.9 [flutter]
- super_enum 0.4.2 [meta equatable]
- url_launcher 5.7.10 [flutter url_launcher_platform_interface url_launcher_web url_launcher_linux url_launcher_macos url_launcher_windows]

dev dependencies:
- auto_route_generator 0.6.9 [build source_gen analyzer path build_runner auto_route]
- build_runner 1.10.2 [args async build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style glob graphs http_multi_server io js logging meta mime path pedantic pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml]
- copy_with_extension_gen 1.4.0 [analyzer build source_gen copy_with_extension]
- flutter_launcher_icons 0.7.5 [image args yaml]
- flutter_native_splash 0.1.9 [yaml image color]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]
- retrofit_generator 1.4.1 [dio source_gen built_collection code_builder tuple retrofit analyzer dart_style build]
- super_enum_generator 0.4.3 [super_enum source_gen analyzer build code_builder dart_style]

transitive dependencies:
- _fe_analyzer_shared 7.0.0 [meta]
- analyzer 0.39.17 [_fe_analyzer_shared args charcode cli_util collection convert crypto glob html meta package_config path pub_semver source_span watcher yaml]
- archive 2.0.13 [crypto args path]
- args 1.6.0
- async 2.5.0-nullsafety.1 [collection]
- basic_utils 2.7.0-rc.4 [http logging json_annotation pointycastle convert crypto]
- bloc 4.0.0 [meta]
- boolean_selector 2.1.0-nullsafety.1 [source_span string_scanner]
- build 1.3.0 [analyzer async convert crypto logging meta path glob]
- build_config 0.4.2 [checked_yaml json_annotation meta path pubspec_parse yaml]
- build_daemon 2.1.4 [built_collection built_value http_multi_server logging pedantic path pool shelf shelf_web_socket stream_transform watcher web_socket_channel]
- build_resolvers 1.3.11 [analyzer build crypto graphs logging path package_config pub_semver]
- build_runner_core 6.0.1 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta path package_config pedantic pool timing watcher yaml]
- built_collection 4.3.2 [collection quiver]
- built_value 7.1.0 [built_collection collection fixnum quiver]
- characters 1.1.0-nullsafety.3
- charcode 1.2.0-nullsafety.1
- checked_yaml 1.0.4 [json_annotation source_span yaml]
- cli_util 0.2.0 [path]
- clock 1.1.0-nullsafety.1
- code_builder 3.5.0 [built_collection built_value collection matcher meta]
- collection 1.15.0-nullsafety.3
- color 2.1.1
- convert 2.1.1 [charcode typed_data]
- country_pickers 1.3.0 [flutter]
- crypto 2.1.5 [collection convert typed_data]
- csslib 0.16.2 [source_span]
- dart_style 1.3.6 [analyzer args path source_span]
- date_range_picker 1.0.6 [flutter]
- datetime_picker_formfield 1.0.0 [flutter intl]
- device_info_platform_interface 1.0.1 [flutter meta plugin_platform_interface]
- dots_indicator 1.2.0 [flutter]
- fake_async 1.2.0-nullsafety.1 [clock collection]
- ffi 0.1.3
- file 5.2.1 [intl meta path]
- firebase_core_platform_interface 2.1.0 [flutter meta plugin_platform_interface quiver]
- firebase_core_web 0.2.1+1 [firebase_core_platform_interface flutter flutter_web_plugins meta js]
- firebase_crashlytics_platform_interface 1.1.4 [flutter meta collection firebase_core plugin_platform_interface]
- fixnum 0.10.11
- flutter_blurhash 0.5.0 [flutter meta]
- flutter_cache_manager 2.0.0 [flutter path_provider uuid http path sqflite pedantic clock file rxdart]
- flutter_chips_input 1.9.5 [flutter]
- flutter_colorpicker 0.3.4 [flutter]
- flutter_keyboard_visibility 4.0.2 [meta flutter_keyboard_visibility_platform_interface flutter_keyboard_visibility_web flutter]
- flutter_keyboard_visibility_platform_interface 1.0.1 [flutter meta plugin_platform_interface]
- flutter_keyboard_visibility_web 1.0.1 [flutter_keyboard_visibility_platform_interface flutter_web_plugins flutter]
- flutter_plugin_android_lifecycle 1.0.11 [flutter]
- flutter_touch_spin 1.0.1 [flutter intl]
- flutter_typeahead 1.9.1 [flutter flutter_keyboard_visibility]
- flutter_web_plugins 0.0.0 [flutter characters collection meta typed_data vector_math]
- glob 1.2.0 [async collection node_io path pedantic string_scanner]
- google_api_availability 2.0.4 [flutter]
- graphs 0.2.0
- html 0.14.0+4 [csslib source_span]
- http_multi_server 2.2.0 [async]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- image 2.1.19 [archive xml meta]
- image_picker 0.6.7+17 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface]
- image_picker_for_web 0.1.0+2 [image_picker_platform_interface flutter flutter_web_plugins meta js]
- image_picker_platform_interface 1.1.1 [flutter meta http plugin_platform_interface]
- injectable 0.4.0+1
- io 0.3.4 [charcode meta path string_scanner]
- js 0.6.2
- json_annotation 3.1.1
- location_permissions 3.0.0+1 [flutter meta]
- logging 0.11.4
- matcher 0.12.10-nullsafety.1 [stack_trace]
- meta 1.3.0-nullsafety.3
- mime 0.9.7
- nested 0.0.4 [flutter]
- node_interop 1.2.1 [js]
- node_io 1.2.0 [file node_interop path]
- observable_ish 2.1.4 [collection]
- octo_image 0.3.0 [flutter flutter_blurhash]
- package_config 1.9.3 [path charcode]
- path 1.8.0-nullsafety.1
- path_drawing 0.4.1+1 [vector_math meta path_parsing flutter]
- path_parsing 0.1.4 [vector_math meta]
- path_provider 1.6.24 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows]
- path_provider_linux 0.0.1+2 [path xdg_directories path_provider_platform_interface flutter]
- path_provider_macos 0.0.4+6 [flutter]
- path_provider_platform_interface 1.0.4 [flutter meta platform plugin_platform_interface]
- path_provider_windows 0.0.4+3 [path_provider_platform_interface meta path flutter ffi win32]
- pedantic 1.9.2 [meta]
- permission_handler_platform_interface 2.0.1 [flutter meta plugin_platform_interface]
- petitparser 3.1.0 [meta]
- phone_number 0.6.3 [flutter]
- platform 2.2.1
- plugin_platform_interface 1.0.3 [meta]
- pointycastle 2.0.0
- pool 1.4.0 [async stack_trace]
- process 3.0.13 [file intl meta path platform]
- pub_semver 1.4.4 [collection]
- pubspec_parse 0.1.7 [checked_yaml json_annotation pub_semver yaml]
- quiver 2.1.5 [matcher meta]
- random_string 2.1.0
- rating_bar 0.2.0 [flutter]
- shared_preferences_linux 0.0.2+4 [file flutter meta path path_provider_linux shared_preferences_platform_interface]
- shared_preferences_macos 0.0.1+11 [shared_preferences_platform_interface flutter]
- shared_preferences_platform_interface 1.0.4 [meta flutter]
- shared_preferences_web 0.1.2+7 [shared_preferences_platform_interface flutter flutter_web_plugins meta]
- shared_preferences_windows 0.0.1+3 [shared_preferences_platform_interface flutter ffi file meta path path_provider_platform_interface path_provider_windows]
- shelf 0.7.9 [async collection http_parser path stack_trace stream_channel]
- shelf_web_socket 0.2.3 [shelf web_socket_channel stream_channel]
- signature 3.2.0 [flutter image]
- sky_engine 0.0.99
- source_gen 0.9.7+1 [analyzer async build dart_style glob meta path pedantic source_span]
- source_span 1.8.0-nullsafety.2 [charcode collection path term_glyph]
- sqflite 1.3.2+1 [flutter sqflite_common path]
- sqflite_common 1.0.2+1 [synchronized path meta]
- stack_trace 1.10.0-nullsafety.1 [path]
- stream_channel 2.1.0-nullsafety.1 [async]
- stream_transform 1.2.0
- string_scanner 1.1.0-nullsafety.1 [charcode source_span]
- sync 0.2.0
- synchronized 2.2.0+2
- term_glyph 1.2.0-nullsafety.1
- test_api 0.2.19-nullsafety.2 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- timing 0.1.1+3 [json_annotation]
- tuple 1.0.3 [quiver]
- typed_data 1.3.0-nullsafety.3 [collection]
- url_launcher_linux 0.0.1+4 [flutter]
- url_launcher_macos 0.0.1+9 [flutter]
- url_launcher_platform_interface 1.0.9 [flutter meta plugin_platform_interface]
- url_launcher_web 0.1.5+1 [url_launcher_platform_interface flutter flutter_web_plugins meta]
- url_launcher_windows 0.0.1+3 [flutter]
- uuid 2.2.2 [crypto convert]
- validators 2.0.1 [vin_decoder]
- vector_math 2.1.0-nullsafety.3
- vin_decoder 0.1.3 [meta basic_utils http random_string]
- watcher 0.9.7+15 [async path pedantic]
- web_socket_channel 1.1.0 [async crypto stream_channel]
- win32 1.7.4 [ffi]
- xdg_directories 0.1.2 [meta path process]
- xml 4.5.1 [collection convert meta petitparser]
- yaml 2.2.1 [charcode collection string_scanner source_span]

What will it give me to spend time on trying to reproduce it on the official example? This is something that worked and still working in a build before I made the updated. Since upgrading no notifications are displayed.. Tried to also replace the firebase core version to firebase_core : ^0.5.0+1 - (like suggested in #4152) still no luck.
already spent hours trying to solve this

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Dec 21, 2020
@markusaksli-nc
Copy link
Contributor

The issue could have arisen from the project version migration. 1.17 is very outdated by this point and a freshly created project with the latest stable contains a lot of changes and fixes.

If you do not run into this issue when just using the code from the official example in a fresh project (after following the setup) then the issue is in the project config.

firebase_messaging 7.0.3 will be soon replaced by the new stable (currently 8.0.0-dev.11) if you are not willing to look into your own project config then you could try to just upgrade to the dev version of the package and use that instead (guide here).

@markusaksli-nc markusaksli-nc added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Dec 21, 2020
@tsahnarExp
Copy link
Author

tsahnarExp commented Dec 21, 2020

@markusaksli-nc i'll try with the 8.00-dev.1. Can I share my project config to try and find out what is causing this? Any specific file/config?

With 8.0.0-dev.11 I cant even get this to trigger (on simulator) when app is in foreground. No message is printed.

FirebaseMessaging.onMessage.listen((RemoteMessage message) {
    print('Got a message whilst in the foreground!');
    print('Message data: ${message.data}');
    if (message.notification != null) {
      print('Message also contained a notification: ${message.notification}');
    }
  });

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Dec 21, 2020
@markusaksli-nc
Copy link
Contributor

What are you using to send the notification? What does the payload look like?

@markusaksli-nc markusaksli-nc added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. impact: deprecated-version This bug exists only in an older version and is no longer present in later releases. labels Dec 22, 2020
@tsahnarExp
Copy link
Author

tsahnarExp commented Dec 22, 2020

What are you using to send the notification? What does the payload look like?

i'm doing just the most basic test with firebase console, sending test message. Something that works when I try with the build before the upgrade

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Dec 22, 2020
@tsahnarExp
Copy link
Author

tsahnarExp commented Dec 22, 2020

BTW I tried to upload the app to test flight, the app was successfully uploaded but I got this warning from apple:

ITMS-90078: Missing Push Notification Entitlement - Your app appears to register with the Apple Push Notification service, but the app signature's entitlements do not include the 'aps-environment' entitlement. If your app uses the Apple Push Notification service, make sure your App ID is enabled for Push Notification in the Provisioning Portal, and resubmit after signing your app with a Distribution provisioning profile that includes the 'aps-environment' entitlement. Xcode does not automatically copy the aps-environment entitlement from provisioning profiles at build time. This behavior is intentional. To use this entitlement, either enable Push Notifications in the project editor's Capabilities pane, or manually add the entitlement to your entitlements file. For more information, see https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/HandlingRemoteNotifications.html#//apple_ref/doc/uid/TP40008194-CH6-SW1.

I have the Capabilities enabled in Xcode so not sure whats the issue here

also got this in ios/Runner/Runner.entitlements

aps-environment
development

could the issue be related to this?

@markusaksli-nc
Copy link
Contributor

Could you try sending a notification through FCM? Are any errors logged to Xcode console?

@markusaksli-nc markusaksli-nc added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Dec 23, 2020
@tsahnarExp
Copy link
Author

tsahnarExp commented Dec 23, 2020

Could you try sending a notification through FCM? Are any errors logged to Xcode console?

Didnt see any errors. Are the notifications supposed to work when running the build on device from Xcode?

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Dec 23, 2020
@tsahnarExp
Copy link
Author

I'm seeing some weird behavior on this too.

Immediately after upgrading, some of my PN work and some don't. Sometimes they end up in the onMessage handler and some just show a flutter print statement of the notification payload without calling onMessage.

Did you find any solution for this?

@markusaksli-nc
Copy link
Contributor

The latest dev version should be working fine but since you are having the same strange issue, I would recommend you take a look at the discussion in #4097.

Moreover since this issue is now just another manifestation of the mentioned one I'm going to close this as a duplicate. If you are unable to solve the issue you can comment on #4097 with your exact case and mention this issue for context.

@firebase firebase locked and limited conversation to collaborators Jan 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs Attention This issue needs maintainer attention. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants