繁体   English   中英

应用程序处于前台时未收到推送通知 ios flutter

[英]Push Notification not received when app is in foreground ios flutter

我已经集成了 firebase 用于在颤振中推送通知。 如果应用程序在前台,我会显示一个包含通知详细信息的对话框。 我在 android 中正确接收通知。 同样在 iOS 中,通知在后台和设备锁定时都可以正常工作。 我也启用了推送通知和后台获取。 有什么解决办法吗? 有没有人遇到过这样的问题?

我正在使用这个 firebase 插件https://pub.dev/packages/firebase_messaging

  1. 在 AppDelegate 中导入 UserNotifications。

  2. UNUserNotificationCenter.current().delegate = self in didFinishLaunch

  3. 在 AppDelegate 中实现下面的方法。

func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping(UNNotificationPresentationOptions) -> Void) { print("Push notification received in foreground.") completionHandler([.alert, .sound, .badge]) }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM