登录时Ionic + firebase错误连接

问题描述 投票:1回答:1

我正在尝试使用本机谷歌地图的离子在我的项目中添加地图,安装后ionic cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"npm install --save @ionic-native/google-mapsthe应用程序开始与一些错误所以我去除插件的删除插件,因为某些原因删除插件我得到此错误当我尝试使用任何类型的firebase auth登录用户时,来自firebase auth/network-request-failed对设备的仿真,但是当我用ionic serve -l运行项目时没有向我显示任何错误。知道会发生什么。

注意:如果我安装谷歌地图的离子原生插件,auht错误消失但错误又回来了所以我不知道在这种情况下我该怎么办。

以防万一

的package.json

{
  "name": "ctgmobileApp",
  "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": "4.4.3",
    "@angular/compiler": "4.4.3",
    "@angular/compiler-cli": "4.4.3",
    "@angular/core": "4.4.3",
    "@angular/forms": "4.4.3",
    "@angular/http": "4.4.3",
    "@angular/platform-browser": "4.4.3",
    "@angular/platform-browser-dynamic": "4.4.3",
    "@ionic-native/core": "4.3.2",
    "@ionic-native/native-page-transitions": "^4.3.3",
    "@ionic-native/screen-orientation": "^4.5.2",
    "@ionic-native/social-sharing": "^4.3.3",
    "@ionic-native/splash-screen": "4.3.2",
    "@ionic-native/status-bar": "^4.3.2",
    "@ionic-native/toast": "^4.4.0",
    "@ionic/storage": "^2.1.3",
    "angularfire2": "^5.0.0-rc.4",
    "com.telerik.plugins.nativepagetransitions": "^0.6.5",
    "cordova-android": "^6.3.0",
    "cordova-plugin-device": "^1.1.4",
    "cordova-plugin-ionic-webview": "^1.1.16",
    "cordova-plugin-screen-orientation": "^2.0.2",
    "cordova-plugin-splashscreen": "^4.0.3",
    "cordova-plugin-statusbar": "^2.2.3",
    "cordova-plugin-whitelist": "^1.3.1",
    "cordova-plugin-x-socialsharing": "^5.2.1",
    "cordova-plugin-x-toast": "^2.6.0",
    "cordova-sqlite-storage": "^2.1.0",
    "es6-promise-plugin": "^4.1.0",
    "firebase": "^4.6.2",
    "ionic-angular": "3.7.1",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "moment": "^2.19.1",
    "promise-polyfill": "^6.0.2",
    "rxjs": "5.4.3",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.18"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.0.1",
    "typescript": "2.3.4"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-sqlite-storage": {},
      "cordova-plugin-x-socialsharing": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "com.telerik.plugins.nativepagetransitions": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-x-toast": {}
    },
    "platforms": [
      "android"
    ]
  }
}

auth.services.ts

  public async loginUsers(email: string, password: string): Promise<any> {
    return await this.fireAuth.auth.signInWithEmailAndPassword(email, password);
  }

login.component.ts

  public login(): void {
    this.userProvider.loginUsers(this.user.email, this.user.password).then((response) => {
      //
    }, (error) => {
      if (error.code == 'auth/wrong-password') {
        this.alerts('Login Fail', '<br><br>Cuenta de correo o contraseña incorrecta.');
      } else if (error.code == 'auth/user-not-found') {
        this.alerts('Login Fail', '<br><br>Correo electronico incorrecto o no existe.');
      } else if (error.code == 'auth/network-request-failed') {
        console.log(error)
        this.alerts('Error de conexion', '<br><br>Verfique que cuenta con una conexion a internet.');
      }
    });
  }
cordova firebase ionic-framework firebase-authentication cordova-plugins
1个回答
0
投票

好吧,试图找到一个解决方案,我终于找到了一些东西,我用cordova nativa谷歌地图得到的错误是在推送页面的那一刻,在推新应用程序页面返回到最后一页并卡在该页面无法做某事,我发现cordova Native Google MapNative Page Transitions之间存在一个小的冲突导致该应用程序的行为,所以我只是删除原生页面过渡并重新安装cordova Native Google Map,这样做的bug就是和firebase的auth再次工作。

老实说,我认为这只是一个临时解决方案。仍然不知道为什么安装和删除Native Google Map插件会导致angularfire2 / firebase出现冲突/错误/问题,但到目前为止我可以找到任何其他解决方案。

我发布这个以防其他人有同样的问题或类似的问题。

© www.soinside.com 2019 - 2024. All rights reserved.