Skip to content
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

[firebase_messaging]: Silent notification not working on iOS, but works on Android in version firebase_messaging: ^15.1.3 #13476

Open
1 task done
dhara6894 opened this issue Oct 8, 2024 · 17 comments · May be fixed by #13525
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. platform: ios Issues / PRs which are specifically for iOS. plugin: messaging type: bug Something isn't working

Comments

@dhara6894
Copy link

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Messaging

Which platforms are affected?

iOS

Description

There is an issue where silent notifications are not working on iOS devices, while they function correctly on Android. The expected behavior is for silent notifications to work consistently across both platforms.

Reproducing the issue

  1. Send a silent notification to an iOS device.
  2. Observe that the notification does not work as expected.
  3. Repeat the same on an Android device, and notice that it works fine.

Firebase Core version

3.6.0

Flutter Version

3.24.3

Relevant Log Output

While checking the logs for the silent notification issue on iOS, it was observed that neither onBackgroundMessage nor onMessage methods are being triggered. This issue is specific to iOS, as the silent notifications work fine on Android, and both methods get called as expected.

Flutter dependencies

Expand Flutter dependencies snippet
Dart SDK 3.5.3
Flutter SDK 3.24.3
UKnowMe 1.0.9+9

dependencies:
alphabet_list_view 1.1.0 [flutter flutter_sticky_header]
amazon_cognito_identity_dart_2 3.6.5 [convert crypto http js]
app_settings 5.1.1 [flutter plugin_platform_interface]
audioplayers 6.0.0 [audioplayers_android audioplayers_darwin audioplayers_linux audioplayers_platform_interface audioplayers_web audioplayers_windows file flutter http meta path_provider synchronized uuid]
cached_network_image 3.4.0 [cached_network_image_platform_interface cached_network_image_web flutter flutter_cache_manager octo_image]
connectivity_plus 6.0.5 [flutter flutter_web_plugins connectivity_plus_platform_interface web meta nm collection]
cupertino_icons 1.0.8
dart_jsonwebtoken 2.14.0 [crypto pointycastle convert collection ed25519_edwards clock]
device_info_plus 10.1.2 [device_info_plus_platform_interface ffi file flutter flutter_web_plugins meta web win32 win32_registry]
dio 5.4.3+1 [async http_parser meta path]
file_picker 5.5.0 [flutter flutter_web_plugins flutter_plugin_android_lifecycle plugin_platform_interface ffi path win32]
firebase_analytics 10.10.7 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter]
firebase_core 2.32.0 [firebase_core_platform_interface firebase_core_web flutter meta]
firebase_crashlytics 3.5.7 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace]
firebase_messaging 14.9.4 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
flutter_app_badger 1.5.0 [flutter]
flutter_branch_sdk 7.1.0 [flutter flutter_web_plugins plugin_platform_interface js]
flutter_dotenv 5.1.0 [flutter]
flutter_image_compress 2.3.0 [flutter flutter_image_compress_platform_interface flutter_image_compress_common flutter_image_compress_web flutter_image_compress_macos flutter_image_compress_ohos]
flutter_local_notifications 17.2.3 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone]
flutter_slidable 3.1.0 [flutter]
flutter_svg 2.0.10+1 [flutter http vector_graphics vector_graphics_codec vector_graphics_compiler]
flutter_timezone 1.0.8 [flutter_web_plugins flutter js]
get_it 7.7.0 [async collection meta]
http 1.2.2 [async http_parser meta web]
image_cropper 7.1.0 [flutter image_cropper_platform_interface image_cropper_for_web]
image_picker 0.8.9 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_linux image_picker_macos image_picker_platform_interface image_picker_windows]
intl 0.19.0 [clock meta path]
intl_phone_field 3.2.0 [flutter]
json_annotation 4.9.0 [meta]
keyboard_actions 4.2.0 [flutter]
otp_autofill 3.0.2 [flutter]
package_info_plus 8.0.2 [ffi flutter flutter_web_plugins http meta path package_info_plus_platform_interface web win32 clock]
permission_handler 11.3.1 [flutter meta permission_handler_android permission_handler_apple permission_handler_html permission_handler_windows permission_handler_platform_interface]
pin_input_text_field 4.5.2 [flutter]
provider 6.1.2 [collection flutter nested]
qr_code_scanner 1.0.1 [js flutter flutter_web_plugins]
qr_flutter 4.1.0 [flutter qr]
reorderable_grid_view 2.2.8 [flutter]
rxdart 0.27.7
share_plus 7.2.2 [cross_file meta mime flutter flutter_web_plugins share_plus_platform_interface file url_launcher_web url_launcher_windows url_launcher_linux url_launcher_platform_interface ffi win32]
shared_preferences 2.2.3 [flutter shared_preferences_android shared_preferences_foundation shared_preferences_linux shared_preferences_platform_interface shared_preferences_web shared_preferences_windows]
shimmer 2.0.0 [flutter]
socket_io_client 3.0.0-beta.2 [logging socket_io_common]
sqflite 2.3.3+1 [flutter sqflite_common path]
stream_video_flutter 0.4.4 [cached_network_image collection equatable flutter flutter_webrtc plugin_platform_interface rate_limiter stream_video visibility_detector]
stream_video_push_notification 0.4.4 [collection firebase_core firebase_messaging flutter flutter_callkit_incoming json_annotation meta plugin_platform_interface rxdart stream_video uuid]
url_launcher 6.3.0 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]
uuid 4.5.1 [crypto sprintf meta fixnum]
video_player 2.8.7 [flutter html video_player_android video_player_avfoundation video_player_platform_interface video_player_web]
video_thumbnail 0.5.3 [flutter]

dev dependencies:
build_runner 2.4.13 [analyzer args async build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style frontend_server_client glob graphs http_multi_server io js logging meta mime package_config path pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml]
flutter_lints 3.0.2 [lints]
flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math leak_tracker_flutter_testing async boolean_selector characters collection leak_tracker leak_tracker_testing material_color_utilities meta source_span stream_channel string_scanner term_glyph vm_service]
json_serializable 6.8.0 [analyzer async build build_config collection json_annotation meta path pub_semver pubspec_parse source_gen source_helper]

transitive dependencies:
_fe_analyzer_shared 67.0.0 [meta]
_flutterfire_internals 1.3.35 [collection firebase_core firebase_core_platform_interface flutter meta]
adaptive_number 1.0.0 [fixnum]
analyzer 6.4.1 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml]
args 2.5.0
asn1lib 1.5.3
async 2.11.0 [collection meta]
audioplayers_android 5.0.0 [audioplayers_platform_interface flutter]
audioplayers_darwin 6.0.0 [audioplayers_platform_interface flutter]
audioplayers_linux 4.0.0 [audioplayers_platform_interface flutter]
audioplayers_platform_interface 7.0.0 [collection flutter meta plugin_platform_interface]
audioplayers_web 5.0.1 [audioplayers_platform_interface flutter flutter_web_plugins web]
audioplayers_windows 4.0.0 [audioplayers_platform_interface flutter]
boolean_selector 2.1.1 [source_span string_scanner]
build 2.4.1 [analyzer async convert crypto glob logging meta package_config path]
build_config 1.1.1 [checked_yaml json_annotation path pubspec_parse yaml]
build_daemon 4.0.2 [built_collection built_value crypto http_multi_server logging path pool shelf shelf_web_socket stream_transform watcher web_socket_channel]
build_resolvers 2.4.2 [analyzer async build collection convert crypto graphs logging package_config path pool pub_semver stream_transform yaml]
build_runner_core 7.3.0 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta package_config path pool timing watcher yaml]
built_collection 5.1.1
built_value 8.9.2 [built_collection collection fixnum meta]
cached_network_image_platform_interface 4.1.1 [flutter flutter_cache_manager]
cached_network_image_web 1.3.0 [cached_network_image_platform_interface flutter flutter_cache_manager]
characters 1.3.0
checked_yaml 2.0.3 [json_annotation source_span yaml]
clock 1.1.1
code_builder 4.10.0 [built_collection built_value collection matcher meta]
collection 1.18.0
connectivity_plus_platform_interface 2.0.1 [flutter meta plugin_platform_interface]
convert 3.1.1 [typed_data]
cross_file 0.3.4+2 [meta web]
crypto 3.0.3 [typed_data]
crypto_keys 0.3.0+1 [pointycastle meta collection quiver]
csslib 1.0.0 [source_span]
dart_style 2.3.6 [analyzer args collection path pub_semver source_span]
dart_webrtc 1.4.8 [collection js logging meta platform_detect synchronized web webrtc_interface]
dbus 0.7.10 [args ffi meta xml]
device_info_plus_platform_interface 7.0.1 [flutter meta plugin_platform_interface]
ed25519_edwards 0.3.1 [collection crypto convert adaptive_number]
equatable 2.0.5 [collection meta]
fake_async 1.3.1 [clock collection]
ffi 2.1.2
file 7.0.0 [meta path]
file_selector_linux 0.9.2+1 [cross_file file_selector_platform_interface flutter]
file_selector_macos 0.9.4 [cross_file file_selector_platform_interface flutter]
file_selector_platform_interface 2.6.2 [cross_file flutter http plugin_platform_interface]
file_selector_windows 0.9.3+1 [cross_file file_selector_platform_interface flutter]
firebase_analytics_platform_interface 3.10.8 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
firebase_analytics_web 0.5.7+7 [_flutterfire_internals firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins]
firebase_core_platform_interface 5.3.0 [collection flutter flutter_test meta plugin_platform_interface]
firebase_core_web 2.17.5 [firebase_core_platform_interface flutter flutter_web_plugins meta web]
firebase_crashlytics_platform_interface 3.6.35 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
firebase_messaging_platform_interface 4.5.37 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
firebase_messaging_web 3.8.7 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins meta web]
fixnum 1.1.0
flutter_cache_manager 3.4.1 [clock collection file flutter http path path_provider rxdart sqflite uuid]
flutter_callkit_incoming 2.0.4+1 [flutter json_annotation]
flutter_image_compress_common 1.0.5 [flutter flutter_image_compress_platform_interface]
flutter_image_compress_macos 1.0.2 [flutter flutter_image_compress_platform_interface]
flutter_image_compress_ohos 0.0.3 [flutter flutter_image_compress_platform_interface]
flutter_image_compress_platform_interface 1.0.5 [flutter plugin_platform_interface cross_file]
flutter_image_compress_web 0.1.4+1 [flutter flutter_web_plugins flutter_image_compress_platform_interface js]
flutter_local_notifications_linux 4.0.1 [dbus ffi flutter flutter_local_notifications_platform_interface path xdg_directories]
flutter_local_notifications_platform_interface 7.2.0 [flutter plugin_platform_interface]
flutter_plugin_android_lifecycle 2.0.19 [flutter]
flutter_sticky_header 0.6.5 [flutter value_layout_builder]
flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math]
flutter_webrtc 0.10.8 [collection dart_webrtc flutter path_provider web webrtc_interface]
frontend_server_client 4.0.0 [async path]
glob 2.1.2 [async collection file path string_scanner]
globbing 1.0.0 [path]
graphs 2.3.1 [collection]
html 0.15.4 [csslib source_span]
http_multi_server 3.2.1 [async]
http_parser 4.0.2 [collection source_span string_scanner typed_data]
image_cropper_for_web 5.1.0 [flutter flutter_web_plugins image_cropper_platform_interface web]
image_cropper_platform_interface 6.1.0 [flutter plugin_platform_interface http]
image_picker_android 0.8.12+1 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface]
image_picker_for_web 2.2.0 [flutter flutter_web_plugins image_picker_platform_interface mime]
image_picker_ios 0.8.12 [flutter image_picker_platform_interface]
image_picker_linux 0.2.1+1 [file_selector_linux file_selector_platform_interface flutter image_picker_platform_interface]
image_picker_macos 0.2.1+1 [file_selector_macos file_selector_platform_interface flutter image_picker_platform_interface]
image_picker_platform_interface 2.10.0 [cross_file flutter http plugin_platform_interface]
image_picker_windows 0.2.1+1 [file_selector_platform_interface file_selector_windows flutter image_picker_platform_interface]
internet_connection_checker 1.0.0+1
io 1.0.4 [meta path string_scanner]
jose 0.3.4 [crypto_keys meta typed_data x509 http http_parser asn1lib collection]
js 0.6.7 [meta]
leak_tracker 10.0.5 [clock collection meta path vm_service]
leak_tracker_flutter_testing 3.0.5 [flutter leak_tracker leak_tracker_testing matcher meta]
leak_tracker_testing 3.0.1 [leak_tracker matcher meta]
lints 3.0.0
logging 1.2.0
matcher 0.12.16+1 [async meta stack_trace term_glyph test_api]
material_color_utilities 0.11.1 [collection]
meta 1.15.0
mime 1.0.5
nested 1.0.0 [flutter]
nm 0.5.0 [dbus]
octo_image 2.1.0 [flutter]
package_config 2.1.0 [path]
package_info_plus_platform_interface 3.0.1 [flutter meta plugin_platform_interface]
path 1.9.0
path_parsing 1.0.1 [vector_math meta]
path_provider 2.1.4 [flutter path_provider_android 
path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows]
path_provider_android 2.2.4 [flutter path_provider_platform_interface]
path_provider_foundation 2.4.0 [flutter path_provider_platform_interface]
path_provider_linux 2.2.1 [ffi flutter path path_provider_platform_interface xdg_directories]
path_provider_platform_interface 2.1.2 [flutter platform plugin_platform_interface]
path_provider_windows 2.2.1 [ffi flutter path path_provider_platform_interface win32]
permission_handler_android 12.0.7 [flutter permission_handler_platform_interface]
permission_handler_apple 9.4.5 [flutter permission_handler_platform_interface]
permission_handler_html 0.1.1 [flutter flutter_web_plugins permission_handler_platform_interface]
permission_handler_platform_interface 4.2.1 [flutter meta plugin_platform_interface]
permission_handler_windows 0.2.1 [flutter permission_handler_platform_interface]
petitparser 6.0.2 [meta]
platform 3.1.5
platform_detect 2.1.0 [meta pub_semver]
plugin_platform_interface 2.1.8 [meta]
pointycastle 3.9.1 [collection convert js]
pool 1.5.1 [async stack_trace]
protobuf 3.1.0 [collection fixnum meta]
pub_semver 2.1.4 [collection meta]
pubspec_parse 1.3.0 [checked_yaml collection json_annotation pub_semver yaml]
qr 3.0.1 [meta]
quiver 3.2.1 [matcher]
rate_limiter 1.0.0
sdp_transform 0.3.2
share_plus_platform_interface 3.4.0 [cross_file flutter meta mime plugin_platform_interface path_provider uuid]
shared_preferences_android 2.2.2 [flutter shared_preferences_platform_interface]
shared_preferences_foundation 2.4.0 [flutter shared_preferences_platform_interface]
shared_preferences_linux 2.3.2 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface]
shared_preferences_platform_interface 2.3.2 [flutter plugin_platform_interface]
shared_preferences_web 2.2.1 [flutter flutter_web_plugins shared_preferences_platform_interface]
shared_preferences_windows 2.3.2 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface]
shelf 1.4.1 [async collection http_parser path stack_trace stream_channel]
shelf_web_socket 2.0.0 [shelf stream_channel web_socket_channel]
sky_engine 0.0.99
socket_io_common 3.0.0-beta.0 [logging]
source_gen 1.5.0 [analyzer async build dart_style glob path source_span yaml]
source_helper 1.3.4 [analyzer collection source_gen]
source_span 1.10.0 [collection path term_glyph]
sprintf 7.0.0
sqflite_common 2.5.4 [synchronized path meta]
stack_trace 1.11.1 [path]
state_notifier 1.0.0 [meta]
stream_channel 2.1.2 [async]
stream_transform 2.1.0
stream_video 0.4.4 [async collection connectivity_plus dart_webrtc device_info_plus equatable fixnum flutter flutter_webrtc http internet_connection_checker intl jose meta protobuf rxdart sdp_transform state_notifier synchronized system_info2 tart uuid web web_socket_channel webrtc_interface]
string_scanner 1.2.0 [source_span]
synchronized 3.1.0+1
system_info2 4.0.0 [globbing path]
tart 0.5.1 [http]
term_glyph 1.2.1
test_api 0.7.2 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph]
timezone 0.9.3 [path]
timing 1.0.1 [json_annotation]
typed_data 1.3.2 [collection]
url_launcher_android 6.3.2 [flutter url_launcher_platform_interface]
url_launcher_ios 6.3.0 [flutter url_launcher_platform_interface]
url_launcher_linux 3.1.1 [flutter url_launcher_platform_interface]
url_launcher_macos 3.2.0 [flutter url_launcher_platform_interface]
url_launcher_platform_interface 2.3.2 [flutter plugin_platform_interface]
url_launcher_web 2.3.3 [flutter flutter_web_plugins url_launcher_platform_interface web]
url_launcher_windows 3.1.2 [flutter url_launcher_platform_interface]
value_layout_builder 0.3.1 [flutter]
vector_graphics 1.1.11+1 [flutter http vector_graphics_codec]
vector_graphics_codec 1.1.11+1
vector_graphics_compiler 1.1.11+1 [args meta path_parsing xml vector_graphics_codec path]
vector_math 2.1.4
video_player_android 2.4.14 [flutter video_player_platform_interface]
video_player_avfoundation 2.6.1 [flutter video_player_platform_interface]
video_player_platform_interface 6.2.2 [flutter plugin_platform_interface]
video_player_web 2.3.2 [flutter flutter_web_plugins video_player_platform_interface web]
visibility_detector 0.4.0+2 [flutter]
vm_service 14.2.5
watcher 1.1.0 [async path]
web 0.5.1
web_socket_channel 2.4.5 [async crypto stream_channel web]
webrtc_interface 1.2.0
win32 5.5.4 [ffi]
win32_registry 1.1.3 [ffi win32]
x509 0.2.4+2 [asn1lib quiver crypto_keys]
xdg_directories 1.0.4 [meta path]
xml 6.5.0 [collection meta petitparser]
yaml 3.1.2 [collection source_span string_scanner]

Additional context and comments

Silent notifications were working correctly with the following package versions:

firebase_core: ^2.27.0
firebase_messaging: ^14.7.19
However, after updating to:

firebase_core: ^3.6.0
firebase_messaging: ^15.1.3
Silent notifications stopped working on iOS. Neither the onBackgroundMessage nor onMessage methods are triggered, while everything works fine on Android.

Steps to reproduce:

Use firebase_core: ^2.27.0 and firebase_messaging: ^14.7.19, send a silent notification, and observe that it works on both iOS and Android.
Update to firebase_core: ^3.6.0 and firebase_messaging: ^15.1.3.
Send a silent notification again and observe that it no longer works on iOS (but still works on Android).
Expected outcome: Silent notifications should continue to work after the package update, with both onBackgroundMessage and onMessage being triggered on iOS.

@dhara6894 dhara6894 added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Oct 8, 2024
@SelaseKay
Copy link
Contributor

Hi @dhara6894 , thanks for the report. I'm currently looking into this.

@SelaseKay SelaseKay added plugin: messaging platform: ios Issues / PRs which are specifically for iOS. labels Oct 8, 2024
@SelaseKay
Copy link
Contributor

SelaseKay commented Oct 8, 2024

I was able to reproduce this issue on iOS 18. Additionally, when I send a test message from the Firebase console, it doesn’t arrive on my device. Could you check if you're seeing the same behavior on your end? Also, which version of iOS are you encountering this issue on?

Reproduced with .../firebase_messaging/example app and .../firebase_messaging/example/scripts

@SelaseKay SelaseKay added the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Oct 8, 2024
@SelaseKay SelaseKay removed the Needs Attention This issue needs maintainer attention. label Oct 8, 2024
@publio-bejao
Copy link

Perhaps this issue is related to #13442

@dhara6894
Copy link
Author

@SelaseKay I have iOS version 17.6.1 on my device, and I am encountering this issue.

@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 Oct 9, 2024
@SelaseKay
Copy link
Contributor

Thanks. Have you tried firing a test message from your Firebase console?

@dhara6894
Copy link
Author

@SelaseKay I have tried sending messages from my app's backend, and although the backend sends a silent notification, I observed that none of the methods are called.

@VinothRishabh
Copy link

@SelaseKay, I am experiencing the same issue. I have also tried using Postman. While normal push notifications are functioning properly, silent notifications are not working

Tried the following payloads:

{
  "message": {
    "token": "{{deviceFCMToken}}",
    "data": {
      "click_action": "FLUTTER_NOTIFICATION_CLICK"
    }
  }
}

and

{
  "message": {
    "token": "{{deviceFCMToken}}",
    "data": {
      "click_action": "FLUTTER_NOTIFICATION_CLICK"
    },
    "apns": {
      "headers": {
        "apns-priority": "5"
      },
      "payload": {
        "aps": {
          "content-available": 1
        }
      }
    }
  }
}

@dhara6894
Copy link
Author

@SelaseKay Have you found anything related to the issue? Let me know if you need further details from me.

@areynolds8787
Copy link

areynolds8787 commented Oct 14, 2024

We have recently experienced an issue within our apps where silent notifications (data-only) weren't triggering the onMessage nor onBackgroundMessage callbacks on iOS (Android was working fine).

We were using:

  • flutter: 3.22.3
  • firebase_core: 3.6.0
  • firebase_messaging: 15.1.3

Non-silent notifications were working as expected, and we could even receive test notifications sent from the Firebase console.

After some debugging, we identified the notification was reaching the device (#8277 (comment)), but the firebase_messaging plugin wasn't handling it for some reason.

After testing disabling method swizzling and handling messages manually without any success, as suggested in some comments in the linked issue, we finally ended up with the following workaround:

We only needed to add the following code to our AppDelegate.swift (with method swizzling enabled by default):

  override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    super.application(application, didReceiveRemoteNotification: userInfo, fetchCompletionHandler: completionHandler)
  }

No other didReceiveRemoteNotification method implementation worked for us, just calling super seemed to do the trick.

Looking for recent changes in the firebase_messaging package that could be related to this issue, we found this commit dropped a default implementation for the deprecated didReceiveRemoteNotification method. Unfortunately, we didn't have the time to test if it's indeed related.

@AhmedLSayed9
Copy link

We're encountering the same issue with data messages (silent notifications) on iOS in version 15.1.3
onMessage callback never triggers while it works fine for Android.

The workaround from @areynolds8787 didn't work for us.

@seoleo96
Copy link

We're encountering the same issue with data messages (silent notifications) on iOS in version 15.1.3
onMessage callback never triggers while it works fine for Android.

@amrgetment
Copy link

areynolds8787 workaround works for me

import Firebase
import Flutter
import UIKit
import flutter_local_notifications

@main
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    FirebaseApp.configure()

    // Start LocalNotifications
    // This is required to make any communication available in the action isolate.
    FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in
      GeneratedPluginRegistrant.register(with: registry)
    }

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

    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }

  override func application(
    _ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any],
    fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void
  ) {
    super.application(
      application, didReceiveRemoteNotification: userInfo, fetchCompletionHandler: completionHandler
    )
  }

}

@begovsky
Copy link

I'm also having this issue. Notifications are working fine on Android but not on IOS. I tried testing it also from console Firebase Messaging -> Send Test Message but still no success.

@phoenixking25
Copy link

@areynolds8787 workaround works for me
Thanks

@russellwheatley
Copy link
Member

russellwheatley commented Oct 21, 2024

Hey @dhara6894, I have a fix for background message handling in iOS that should allow you to turn FirebaseAppDelegateProxyEnabled back to true.

Could you try this branch: #13525, and let me know if it works for you?

Thanks 🙏

@russellwheatley russellwheatley added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Oct 21, 2024
@areynolds8787
Copy link

Hey @russellwheatley! Thanks for the fix. I can confirm data-only notifications are working without having to apply any workaround using the linked branch.

Just to clarify, we had to keep FirebaseAppDelegateProxyEnabled true by default to make our workaround work, so we just removed the didReceiveRemoteNotification implementation from the AppDelegate and now everything works as expected.

@amrgetment
Copy link

Is this fix work for macOS?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. platform: ios Issues / PRs which are specifically for iOS. plugin: messaging type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.