繁体   English   中英

Ionic 3 Facebook登录

[英]Ionic 3 facebook login

我已经为我的Ionic 3应用程序创建了一个Facebook登录名-一切正常,没有任何问题,但是不再可行。

我的welcome.ts文件

loginWithFacebook() {
   this.loading = true;
   this.userService.loginWithFacebook().then((success) => {
      let profile = success.additionalUserInfo.profile;
      console.log('Successfully')
}

我的用户提供程序文件

loginWithFacebook(){
   if (this.platform.is('cordova')) {
      console.log('Mobile login');
      return this.fb.login(['email', 'public_profile']).then(res => {
         console.log('entered facebook login code');
         const facebookCredential = firebase.auth.FacebookAuthProvider
            .credential(res.authResponse.accessToken);
            return firebase.auth().signInWithCredential(facebookCredential);
     });
  } else {
       console.log('Web login');
       return this.afAuth.auth.signInWithPopup(new firebase.auth.FacebookAuthProvider());
}

}

在Chrome中,该功能可以完美运行,但是在iPhone上构建并运行该功能时,它将永远无法到达welcome.ts文件中的“然后”部分,而不会在其中运行代码。

在设备上运行时,我是否错过了其他内容?

您是否已将Firebase添加到iOS应用程序? 如果您还没有:登录Firebase控制台,打开项目设置,然后选择“将Firebase添加到您的iOS应用”。

下载GoogleService-Info.plist配置文件并将其复制到项目的以下路径: project_name/platforms/ios/project_name/resourcesproject_name/platforms/ios/project_name/resources/resources

运行ionic cordova build ios然后尝试再次运行您的应用程序。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM