ios - react-native-firebase 在通知打开时没有注册的监听器 ios
问题描述
我正在使用 onNotificationOpened。在 Android 上它工作得很好,但在 ios 上单击 Xcode 中的推送会在“打开没有侦听器的通知时”写入控制台。我怎样才能解决这个问题?这是我的代码:
firebase.messaging().requestPermission();
firebase.auth().onAuthStateChanged(async () => {
const registerToken = await AsyncStorage.getItem('registerPushToken');
firebase
.messaging()
.getToken()
.then(async Devicetoken => {
if (registerToken === Devicetoken) return;
await dispatch(subscribeNotify(Devicetoken));
await AsyncStorage.setItem('registerPushToken', Devicetoken);
});
});
firebase.messaging().onTokenRefresh(async data => {
const registerToken = await AsyncStorage.getItem('registerPushToken');
if (registerToken) {
await dispatch(
unsubscribeNotify({
registrationToken: registerToken,
deleteInstance: false,
}),
);
}
await dispatch(subscribeNotify(data));
await AsyncStorage.setItem('registerPushToken', data);
});
firebase.notifications().onNotificationOpened(notificationOpen => {
pushController(notificationOpen.notification._data);
});
应用目标平台:iOS 11.3
React Native 版本:0.55.2
RNFirebase 版本:4.0.5
Firebase 模块:通知、云消息传递
解决方案
推荐阅读
- c# - 强制字符串插值始终遵循 CultureInfo.InvariantCulture
- python - 将使用 C++ 和 Open MPI 生成的处理器等级发送到 Python 脚本
- azure-devops - 如何从 *.nuspec 在 Azure Pipelines 中仅设置主要和次要 NuGet 包版本?
- excel - Oracle12C 查询和 Access 查询有什么区别?
- amp-html - (十一) 如何为src *.md文件生成rel="amphtml" 格式
- javascript - 使用 javascript 查找活动的引导模式
- c++ - 如何使用 Mac 终端执行我的 C++ 程序?
- java - 为什么下面是一个变异累加操作的例子?
- flutter - 在 StreamProvider 上设置 listen to false 是否会阻止云 Firestore 读取费用?
- scala - 在Scala中的函数中导入包时将导入多少次