当应用程序在后台并在前台接收时,为什么在 IOS 上收不到 FCM 通知?扑

Why does not receive FCM notifications on IOS when the app is in background and receive in foreground? Flutter

我有一个 Flutter 应用程序,它会在某个时刻向所有用户发送 Firebase 通知。它在 android 下运行良好,但在 iOS 下仅适用于打开应用程序。如果我关闭应用程序(或例如转到主屏幕),它没有收到任何东西。

我已经设置 'priority' : 'high', "content_available" : true 但仍然无法正常工作。我该怎么做才能执行它?

如果你需要一些code/info我更新问题。

更新:是的,我正在使用 onResume

    _firebaseMessaging.configure(

      onMessage: (Map<String, dynamic> message) async {
        print("onMessage: ${message}");
        print(message['notification']['body']);

      },

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

您是否在配置中使用了 onResume?
你需要添加它。看看