iOS FCM无法使用的OnSelectNotification,我该怎么办?

发布于 2025-02-09 13:08:20 字数 646 浏览 0 评论 0原文

我正在尝试打印(“测试”);当我单击通知时(打开应用程序),但没有调用该函数。我能做些什么?也许在info.plist中插入一些东西?但是我没有为iOS喜欢的Android找到任何东西,而是将代码放置以进行click_notification。 OBS:它对Android完美效果。遵循代码:

  var androiInit = AndroidInitializationSettings('@mipmap/ic_launcher');//for logo
    var iosInit = IOSInitializationSettings();
    var initSetting=InitializationSettings(android: androiInit,iOS:
    iosInit);
    var fltNotification = FlutterLocalNotificationsPlugin();
    fltNotification.initialize(initSetting,onSelectNotification: onSelectNotification);
Future<void> onSelectNotification(String? payload) async {
print("test");
}

I'm trying to print("test"); when I click on the notification ( with the app opened ) but it's not calling the function. What can I do? Maybe insert something inside info.plist? But i didn't found nothing for iOS like for android that you put the code for CLICK_NOTIFICATION. OBS: it works perfectly for android. follow the code:

  var androiInit = AndroidInitializationSettings('@mipmap/ic_launcher');//for logo
    var iosInit = IOSInitializationSettings();
    var initSetting=InitializationSettings(android: androiInit,iOS:
    iosInit);
    var fltNotification = FlutterLocalNotificationsPlugin();
    fltNotification.initialize(initSetting,onSelectNotification: onSelectNotification);
Future<void> onSelectNotification(String? payload) async {
print("test");
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文