首页 > 解决方案 > firebase.notifications().getInitialNotification() 在 iOS 中返回 null

问题描述

我有一个 React Native 项目并且我正在使用 Firebase,因此react-native-firebase在我的项目中使用 npm 包来处理推送通知。我按照这里的文档。到目前为止,一切似乎都很好,除了在 iOSgetInitialNotification()中不断给我的功能。null因此,我无法检查应用程序是否通过通知点击打开。不过,一切都像 Android 中的魅力一样。

有什么建议么?

async componentDidMount() {
    const notificationOpen: NotificationOpen = await firebase.notifications().getInitialNotification();
    console.log(notificationOpen); // Outputs null
}

解决了

我通过使用最新的 react-native (0.59.9 > 0.60.5) 和 react-native-firebase (5.5.4 > 5.5.6) 版本解决了这个问题。

标签: firebasereact-nativepush-notificationfirebase-cloud-messagingreact-native-firebase

解决方案


推荐阅读