簡體   English   中英

Flutter:當應用程序處於后台但未在 iOS 中終止時,無法在通知單擊時重定向到特定屏幕

[英]Flutter : Unable to redirect to specific screen on Notification click when app is in background but not terminated in iOS

我已經使用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和 flutter 版本v1.12.13+hotfix.5

已經提到了這些問題935 , 1757 , 1677但沒有任何幫助。

嗨,我有完全相同的問題。 因此,根據插件的當前文檔 (firebase_messaging),您應該對 Appdelegate.m/Appdelegate.swift 文件進行一些修改。

這個修改是有問題的。

從您的刪除下面的代碼AppDelegate.swift或類似AppDelegate.m

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

這似乎是與此版本firebase_messaging(6.0.9)的錯誤或問題,因為在這里

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM