Flutter:当应用程序处于后台但未在iOS中终止时,无法在通知单击时重定向到特定屏幕

问题描述 投票:2回答:1

我已经使用firebase_messaging插件进行通知,在两个平台上,通知都可以正常工作,

但是,我想将用户重定向到通知单击事件上的特定屏幕。对于Android端,它工作正常。但是对于IOS,如果应用程序在后台并且没有终止,则无法使用(如果应用程序终止,则可以正常工作)。

这是我的用于通知集成的代码示例:

_firebaseMessaging.configure(
  onMessage: (Map<String, dynamic> message) async {
    print("onMessage: $message");
    gotoTempPage();
  },
  onLaunch: (Map<String, dynamic> message) async {
    print("onLaunch: $message");
    gotoTempPage();
  },
  onResume: (Map<String, dynamic> message) async {
    print("onResume: $message");
    gotoTempPage();
  },
);

我使用的插件版本为firebase_messaging: ^6.0.9,而使用的版本为v1.12.13+hotfix.5

已经提到了这些问题93517571677,但没有任何帮助。

ios flutter push-notification firebase-cloud-messaging
1个回答
0
投票

嗨,我有完全一样的问题。因此,根据插件的当前文档(firebase_messaging),您应该对Appdelegate.m / Appdelegate.swift文件进行一些修改。此修改是问题。AppDelegate.swift或类似的AppDelegate.m]中删除以下代码

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

[here中的此版本的firebase_messaging(6.0.9)似乎是错误或问题,>

© www.soinside.com 2019 - 2024. All rights reserved.