Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在未注册侦听器的情况下打开通知时对本机firebase作出反应_Ios_Firebase_React Native Firebase - Fatal编程技术网

Ios 在未注册侦听器的情况下打开通知时对本机firebase作出反应

Ios 在未注册侦听器的情况下打开通知时对本机firebase作出反应,ios,firebase,react-native-firebase,Ios,Firebase,React Native Firebase,我正在使用onNotificationOpened。在Android上,它工作得很好,但在ios上,点击push-in Xcode会将控制台写入“通知打开时没有侦听器”。我怎样才能解决这个问题? 这是我的代码: firebase.messaging().requestPermission(); firebase.auth().onAuthStateChanged(async () => { const registerToken = await AsyncSto

我正在使用onNotificationOpened。在Android上,它工作得很好,但在ios上,点击push-in 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本机版本:0.55.2

  • RNFirebase版本:4.0.5

  • Firebase模块:通知、云消息