我正在尝试实现 FIrebase UI 电话号码身份验证,但在验证电话号码后未调用委托方法。有什么原因吗?
class Login: UIViewController, FUIAuthDelegate {
let authUI = FUIAuth.defaultAuthUI()
override func viewDidAppear(_ animated: Bool) {
let phoneProvider = FUIPhoneAuth(authUI: authUI!)
authUI!.isSignInWithEmailHidden = true
authUI!.providers = [phoneProvider]
phoneProvider.signIn(withPresenting: self, phoneNumber: nil)
}
//this method does not work either... it is not called
func authUI(_ authUI: FUIAuth, didSignInWith authDataResult: AuthDataResult?, error: Error?) {
print("user is (authDataResult!.user.email)")
print("err is (error?.localizedDescription)")
guard error == nil else {
print(error)
return
}
}
}
我忘了将自己分配为authUI
的委托
override func viewDidAppear(_ animated: Bool) {
authUI?.delegate = self
let phoneProvider = FUIPhoneAuth(authUI: authUI!)
authUI!.isSignInWithEmailHidden = true
authUI!.providers = [phoneProvider]
phoneProvider.signIn(withPresenting: self, phoneNumber: nil)
}