Flutter 当应用程序处于后台或终止时,不显示用于颤振IOS通知的FCM

Flutter 当应用程序处于后台或终止时,不显示用于颤振IOS通知的FCM,flutter,firebase-cloud-messaging,Flutter,Firebase Cloud Messaging,我使用Firebase云消息传递实现了颤振。所有这些在Android中都运行良好,但iOS推送通知只在应用程序处于前台时显示 请帮助我在后台显示通知应用程序并终止 这些就是我迄今为止所做的步骤 创建了firbase项目 将GoogleService-Info.plist添加到xcode 将firebase消息:^6.0.13和颤振本地通知:^1.3.0添加到pubspec.yaml中 飘飘然 FirebaseMessaging firebaseMessaging = new FirebaseM

我使用Firebase云消息传递实现了颤振。所有这些在Android中都运行良好,但iOS推送通知只在应用程序处于前台时显示

请帮助我在后台显示通知应用程序并终止

这些就是我迄今为止所做的步骤

  • 创建了firbase项目
  • 将GoogleService-Info.plist添加到xcode
  • 将firebase消息:^6.0.13和颤振本地通知:^1.3.0添加到pubspec.yaml中
  • 飘飘然

    FirebaseMessaging firebaseMessaging = new FirebaseMessaging();
    FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
    new FlutterLocalNotificationsPlugin();
    
    
    
    @override
    void initState() {
    super.initState();
    var android = new 
    AndroidInitializationSettings('mipmap/ic_launcher');
    var ios = new IOSInitializationSettings();
    var platform = new InitializationSettings(android, ios);
    flutterLocalNotificationsPlugin.initialize(platform);
    
    firebaseMessaging.configure(
    onLaunch: (Map<String, dynamic> msg) async{
    print(" onLaunch called ${(msg)}");
    },
    
    onResume: (Map<String, dynamic> msg) async{
    print(" onResume called ${(msg)}");
    },
    onMessage: (Map<String, dynamic> msg) async{
    showNotification(msg);
    print(" onMessage called ${(msg)}");
    },
    );
    firebaseMessaging.requestNotificationPermissions(
    const IosNotificationSettings(sound: true, alert: true, badge: 
    true));
    firebaseMessaging.onIosSettingsRegistered
    .listen((IosNotificationSettings setting) {
    print('IOS Setting Registed');
    });
    firebaseMessaging.getToken().then((token) {
    update(token);
    });
    getCashedInfo();
    }
    
    
    
    showNotification(Map<String, dynamic> msg) async {
    var android = new AndroidNotificationDetails(
    'sdffds dsffds',
    "CHANNLE NAME",
    "channelDescription",
    );
    var iOS = new IOSNotificationDetails();
    var platform = new NotificationDetails(android, iOS);
    await flutterLocalNotificationsPlugin.show(
     0, "This is title", "this is demo", platform);
    }
    
    update(String token) {
    print(token);
    
    }
    

  • 那么,你找到答案了吗?喂?你找到答案了吗?我也有同样的问题。我猜没有。这个问题上有几十个线程,没有记录在案的、可重复的更正。有解决方案吗?我被这个困住了。。。。
    if #available(iOS 10.0, *) {
      UNUserNotificationCenter.current().delegate = self as? 
    UNUserNotificationCenterDelegate
    }