- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试通过 FirebaseUI Auth 连接 Facebook 登录,但是我无法让 Facebook 连接按钮出现在实例化的 authViewController 中。平台:iOS,语言:Swift 2.0,最新稳定的 Xcode 版本
就拉起实例化 authViewController 而言,一切都正常工作。电子邮件/密码选项已存在,并会在我的 Firebase 数据库中主动创建新用户。
我在尝试实现 Facebook 登录功能时遇到的问题;
在我的 AppDelegate.swift 文件中,我有以下内容:
import Firebase
import FirebaseAuthUI
...
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
FIRApp.configure()
let authUI = FIRAuthUI.authUI()!
authUI.delegate = self
return true
}
我收到的错误是“无法将“AppDelegate”类型的值分配给“FIRAuthUIDelegate”类型” - 基本上我无法让以下行工作; authUI.delegate = self
我已阅读所有文档并浏览了项目 gitHub 存储库中有关实现的开放/已关闭问题: https://github.com/firebase/FirebaseUI-iOS/tree/master/FirebaseUI
我已经查看了之前的 StackOverflow 问题,该问题本质上与此处类似; How to use FirebaseUI for Google authentication on iOS in Swift?
我尝试从上面的 Stack Overflow 中复制代码,因为他声明他确实使用他的代码获得了更多显示选项(他的问题是关于身份验证的进一步错误),但我仍然遇到了同样的问题委托(delegate)错误。我尝试将 FIRAuthUIDelegate 分配给 AppDelegate 但它不符合要求。我错过了什么?
最佳答案
我也不熟悉 FirebaseUI,但这里有一个使用常规 Firebase 和 FBSDK 向 Facebook 授权用户的工作示例
@IBAction func fbButtonTapped(sender: UIButton) {
let facebookReadPermissions = ["email", "public_profile", "user_photos"]
FBSDKLoginManager().logInWithReadPermissions(facebookReadPermissions, fromViewController: self, handler: { (result:FBSDKLoginManagerLoginResult?, error:NSError?) -> Void in
if error != nil {
Helper.displayAlert("Error Logging into Facebook", message: error!.localizedDescription, viewController: self)
} else {
let credential = FIRFacebookAuthProvider.credentialWithAccessToken(FBSDKAccessToken.currentAccessToken().tokenString)
FIRAuth.auth()?.signInWithCredential(credential) { (user, error) in
if error != nil {
Helper.displayAlert("Error Logging into Facebook", message: error!.localizedDescription, viewController: self)
} else {
let request = FBSDKGraphRequest(graphPath:"me", parameters: ["fields": "id, first_name, last_name, email, age_range, gender, verified, timezone, picture"])
request.startWithCompletionHandler {
(connection, result, error) in
if error != nil {
print (error)
} else if let userData = result as? [String : AnyObject] {
guard let userID = FIRAuth.auth()?.currentUser?.uid else { return }
let userInfo = ["firstName": userData["first_name"] as! String, "lastName": userData["last_name"] as! String, "email": userData["email"] as! String,
"gender": userData["gender"] as! String, "id": userData["id"] as! String, "verified": userData["verified"]?.description as! AnyObject, "key": userID]
FirebaseData.fbData.createFirebaseUser(userID, user: userInfo)
self.performSegueWithIdentifier(self.loginSucessIdentifier, sender: nil)
}
}
}
}
}
})
}
func createFirebaseUser(uid: String, user: [String : AnyObject]) {
REF_USERS.child(uid).setValue(user)
}
可以稍微清理一下代码以删除所有 if let 语句,但它应该可以让您获得 facebook 登录的工作授权。
关于ios - 尝试通过 FirebaseUI Auth 连接 Facebook 登录,但遇到 authUI.delegate = self 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38044243/
我的代码有问题。我正在用 ReactJS 构建一个包含 3 个选项卡的单页网络应用程序。 当用户转到一个选项卡时,应该会显示来自 FirebaseUI 的身份验证表单。问题是它只在第一次和第二次工作,
我正在尝试实现 Firebase 身份验证。使用提供的用户界面, 我不知道单击“取消”按钮时调用了什么方法。似乎没有记录,https://github.com/firebase/firebaseui-
我在使用 FirebaseUI 时遇到问题。问题是,它会在启动时启动电子邮件登录流程,而无需单击任何内容。我希望它显示不同的登录选项,但它一直在启动电子邮件登录流程。我想让它显示这个: image 但
我正在使用firebaseui-web-react。在注册流程中,我想在创建用户之前验证用户提供的 displayName。特别是,我想确保 displayName 是唯一的。 我知道如何使用 Fir
我使用 FirebaseUI 进行登录。无论我如何尝试,我都无法使登录屏幕保持纵向模式。我在这里做错了什么?我怀疑这是 list 中的内容。 有趣的是,启动屏幕保持纵向模式,然后立即进入横向模式。我找
我已经创建了用于身份验证的自定义布局,但未显示该布局,而是显示了电子邮件登录屏幕 val customLayout = AuthMethodPickerLayout.Builder(R.layout.
这个问题已经有答案了: How can I detect if user first time in Firebase [duplicate] (4 个回答) 已关闭 3 年前。 我有一个 Andro
我想在我的项目中实现 FirebaseUI,但登录页面未显示任何输入字段或按钮: 显示FUIAuth的代码: @IBAction func logInButtonTapped(_ sender: An
我正在使用 FirebaseUI Android 用户使用以下代码登录: startActivityForResult( AuthUI.getInstance().c
我不太明白 recyclerView 和 glide 在缓存信息和图像数据方面是如何工作的,所以我想知道是否有人可以提供帮助。 目前,我将有关图像的元数据存储在实时数据库中。元数据有足够的信息可以进行
在我最近访问 Firestore 之后,我尝试使用 Firebase-UI 的 RecyclerView,但我找不到将新元素添加到特定位置的方法。 这是我对基本 RecyclerView 的处理方式:
我想使用 FirebaseUI RecyclerView。 我目前的应用程序(build.gradle)如下: implementation 'com.android.support:appc
我正在学习我在 Firebase (Udacity) 中的第一门类(class),并且有看起来像这样实现 Firebase Auth 的代码 private FirebaseAuth mFirebas
我正在使用 FirebaseUI 数据库使用 FirebaseListAdapter 从 ListView(在 ListFragment 上)的 Firebase 数据库引用中检索对象列表。我在 bu
我正在尝试为我的网站实现强制登录。我遇到的问题是我找不到这样做的方法。假设我创建了一个登录页面,例如... var uiConfig = { signInSuccessUrl: '',
我目前正从 Android 开发转向使用 Firebase 的 Swift 开发。 在 Android 中,很容易将 Firebase 检索到的快照解析为对象(例如 dataSnapshot.getv
按照 here 指南,我正在尝试将 Apple 登录添加到我的 iOS 应用程序。我已经使用这种方法成功实现了谷歌登录,但 Apple 似乎无法正常工作。我可以到达它要求我的苹果密码的地步,但它只是继
我正在使用 FirebaseUI for Web — 身份验证小部件来简化身份验证工作流程,但我遇到了一个问题。第一次一切正常。但是,在我登录后,小部件内容会清除,并且“使用...登录”按钮再也不会出
我有一个 JS 文件,我正在尝试使用 Firebase。 这是导致问题的部分(特别是 firebaseUI) var firebase = require('firebase'); var fireb
我正在努力解决一些看起来小菜一碟的问题,但我仍然无法找到解决方案。 我正在使用reactjs和firebaseUI web react实现firebase身份验证过程。一切都很好,除了当我尝试使用电子
我是一名优秀的程序员,十分优秀!