![](/img/trans.png)
[英]Unable to listen notification from NSNotificationCenter when App received push notification from background or terminated in 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
嗨,我有完全相同的問題。 因此,根據插件的當前文檔 (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.