在macOS中,Flutter的Firebase Auth SDK中不存在SignInWithFacebook函数,但在Windows中却存在 [英] Function SignInWithFacebook doesn't exist in Firebase Auth SDK for Flutter in macOS, but in Windows it exists

查看:131
本文介绍了在macOS中,Flutter的Firebase Auth SDK中不存在SignInWithFacebook函数,但在Windows中却存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今年开始使用Flutter,所以我不是专家. 我正在尝试为Android和iOS开发一款应用,其中包括使用Firebase Auth登录Google和Facebook.

I have started using Flutter this year, so I am not an expert. I am trying to develop an app for both Android and iOS that includes login with Google and Facebook using Firebase Auth.

首先,我在Windows的Android Studio中编写了代码,并且可以正常工作,但是当我在macOS的Android Studio中编写代码时,某些代码行无法正常工作.我已经在Firebase控制台和Facebook上为开发人员控制台"配置了iOS项目.我没有使用CocoaPods添加框架,而是在Xcode上手动完成的.

First I wrote the code in Android Studio in Windows and it works, but when I write it in Android Studio in macOS some lines of code don't work properly. I have configured the iOS project on the Firebase console and on Facebook for developers 'console'. I didn't use CocoaPods to add the frameworks, but I did it manually on Xcode.

基本上,错误是:The method 'signInWithFacebook' isn't defined for the class 'FirebaseAuth'.

推荐答案

signInWithFacebook不再存在. 这是完美的工作! flutter_facebook_login 3.0.0

signInWithFacebook is no longer exist. This is work perfectly! flutter_facebook_login 3.0.0

final FacebookLoginResult facebookLoginResult = await facebookLogin.logIn(['email', 'public_profile']);
FacebookAccessToken facebookAccessToken = facebookLoginResult.accessToken;
AuthCredential authCredential = FacebookAuthProvider.getCredential(accessToken: facebookAccessToken.token);
FirebaseUser fbUser;
fbUser = (await _firebaseAuth.signInWithCredential(authCredential)).user;

这篇关于在macOS中,Flutter的Firebase Auth SDK中不存在SignInWithFacebook函数,但在Windows中却存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆