gpt4 book ai didi

android - window.FirebasePlugin.verifyPhoneNumber is not a function 错误

转载 作者:行者123 更新时间:2023-11-29 19:05:14 26 4
gpt4 key购买 nike

我有一个 ionic 项目(由 Ionic CLI 创建)。我正在尝试将 firebase 的电话身份验证机制集成到登录用户中。根据不同的教程和指南,我知道我必须依赖一些分支,因为官方 firebase 插件尚不支持电话身份验证。

我遇到了——1. https://github.com/jestcastro/cordova-plugin-firebase&2. https://github.com/arnesson/cordova-plugin-firebase

并分别安装它们。

两者结构相似:

window.FirebasePlugin.verifyPhoneNumber(number, timeOutDuration, function(credential) {
console.log(credential);

// ask user to input verificationCode:
var code = inputField.value.toString();

var verificationId = credential.verificationId;

var signInCredential = firebase.auth.PhoneAuthProvider.credential(verificationId, code);
firebase.auth().signInWithCredential(signInCredential);
}, function(error) {
console.error(error);
});

但是,每当我尝试运行代码(在物理设备或浏览器中)时,它都会给我这个错误 -

ERROR TypeError: window.FirebasePlugin.verifyPhoneNumber is not a function

我试过了-

(<any>window).FirebasePlugin.verifyPhoneNumber(..)

但发现了类似的结果。

Ionic Info 给出了这个:

    @ionic/cli-plugin-proxy : 1.4.11
@ionic/cli-utils : 1.12.0
ionic (Ionic CLI) : 3.12.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.1.0
Cordova Platforms : none
Ionic Framework : ionic-angular 3.9.2

System:

Android SDK Tools : 26.0.2
Node : v6.11.3
npm : 3.10.10
OS : Windows 7

Misc:

backend : pro

package.json

{
"name": "playground",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "5.0.0",
"@angular/compiler": "5.0.0",
"@angular/compiler-cli": "5.0.0",
"@angular/core": "5.0.0",
"@angular/forms": "5.0.0",
"@angular/http": "5.0.0",
"@angular/platform-browser": "5.0.0",
"@angular/platform-browser-dynamic": "5.0.0",
"@ionic-native/camera": "^4.4.0",
"@ionic-native/core": "4.3.2",
"@ionic-native/file": "^4.4.0",
"@ionic-native/file-transfer": "^4.4.0",
"@ionic-native/splash-screen": "4.3.2",
"@ionic-native/status-bar": "4.3.2",
"@ionic/storage": "2.1.3",
"angularfire2": "^5.0.0-rc.4",
"cordova-android": "~6.3.0",
"cordova-plugin-camera": "^3.0.0",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-file": "^5.0.0",
"cordova-plugin-file-transfer": "^1.7.0",
"cordova-plugin-firebase": "^0.1.24",
"cordova-plugin-ionic-webview": "^1.1.16",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-whitelist": "^1.3.1",
"firebase": "^4.6.2",
"ionic-angular": "3.9.2",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18"
},
"devDependencies": {
"@ionic/app-scripts": "3.1.0",
"typescript": "2.4.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"ionic-plugin-keyboard": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-file-transfer": {},
"cordova-plugin-file": {},
"cordova-plugin-camera": {},
"cordova-plugin-firebase": {}
},
"platforms": [
"android"
]
}
}

有没有人遇到过这个问题?你是如何设法解决它的?寻求帮助。

最佳答案

您需要安装cordova-plugin-firebase 使用ionic cordova plugin add https://github.com/jestcastro/cordova-plugin-firebase.git --save.当我们使用 ionic cordova plugin add cordova-plugin-firebase 安装时会发生此错误。

关于android - window.FirebasePlugin.verifyPhoneNumber is not a function 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47511913/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com