"成功时出错callbackId:FirebasePlugin223329663:TypeError:无法读取属性' navCtrl' of null"

时间:2018-05-10 09:05:29

标签: javascript firebase firebase-realtime-database ionic3 cordova-plugins

在使用navCtr链接到repo时,我无法使用cordova-plugin-firebase离子导航到此错误,我无法导航到下一个错误。

我的ts文件

    window.FirebasePlugin.verifyPhoneNumber(phoneNumber, 60, function (credential) {
        console.log(credential);
        let verificationId = credential.verificationId;
        this.navCtrl.push(AuthDeviceVerifyPage, { verificationid: verificationId });
    }

错误正在

        [INFO:CONSOLE(309)] "Error in Success callbackId: FirebasePlugin1582498724 : TypeError: Cannot read property 'goToVerify' of null", source: file:///android_asset/www/cordova.js (309)
        [INFO:CONSOLE(311)] "Uncaught TypeError: Cannot read property 'goToVerify' of null", source: file:///android_asset/www/cordova.js (311)

I / PhoneAuthProvider:Sms自动检索超时。 W / IInputConnectionWrapper:非活动InputConnection上的getExtractedText                            getTextBeforeCursor在非活动的InputConnection

1 个答案:

答案 0 :(得分:1)

我能够通过制作一个对象并使用该对象来解决这个问题。

 // add a local variable to store navCtrl object
        let thatNavCtrl = this.navCtrl;
        window.FirebasePlugin.verifyPhoneNumber(phoneNumber, 60, function (credential) {
            let verificationId = credential.verificationId;
            thatNavCtrl.push(AuthDeviceVerifyPage, { verificationid: verificationId });

        }, (error) => {
              console.error(error);
        });

    }