React native firebase.notifications().getInitialNotification()不';当应用程序在IOS中处于后台时无法工作

React native firebase.notifications().getInitialNotification()不';当应用程序在IOS中处于后台时无法工作,react-native,React Native,我收到通知,但当应用程序处于后台时,下面的代码在IOS中不起作用。当用户通过通知进入应用程序时,我想将用户重定向到特定页面。 我遵循以下程序 您必须为打开的通知添加代码,如下所示: componentDidMount(){ this.notificationOpenedListener=firebase.notifications().onNotificationOpened((通知)=>{ 警报(“GetInitialNossTification”); if(this.state.isUser

我收到通知,但当应用程序处于后台时,下面的代码在IOS中不起作用。当用户通过通知进入应用程序时,我想将用户重定向到特定页面。 我遵循以下程序


您必须为打开的通知添加代码,如下所示:

componentDidMount(){
this.notificationOpenedListener=firebase.notifications().onNotificationOpened((通知)=>{
警报(“GetInitialNossTification”);
if(this.state.isUser){
等待AsyncStorage.setItem(“getNotificationsKey”、“true”);
//log(“jkasghfghhdfgj isUser true”);
}否则{
//log(“jkasghfghhdfgj isUser false”);
}
});
}
组件将卸载(){
this.notificationOpenedListener();
}
componentDidMount()
{
const notificationOpen: NotificationOpen = await firebase
     .notifications()
     .getInitialNotification();
   if (notificationOpen) {
    alert("getInitialNossssssssstification");

     if (this.state.isUser) {
       await AsyncStorage.setItem("getNotificationsKey", "true");
       // console.log("jkasghfghdfgj isUser true");
     } else {
       // console.log("jkasghfghdfgj isUser false");
     }
   } else {
     console.log("elseeeeeeee");
   }
}