我如何修复FIRAuth错误,然后修复出现在单词后的Auth错误?
下面的代码是我开发的代码。 FIRAuth错误是:
FIRAuth已更改为Auth。
然后,Auth错误是一个未解析的标识符。
import UIKit
import Firebase
class ViewController: UIViewController {
@IBOutlet weak var emailField: UITextField!
@IBOutlet weak var passwordField: UITextField!
var userUid: String!
func goToCreateUserVC(){
performSegue(withIdentifier: "SignUp", sender: nil)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?){
if segue.identifier == "SignUp" {
if let destination = segue.destination as? UserVC {
if userUid != nil {
destination.userUid = userUid
}
if emailField.text != nil {
destination.emailField = emailField.text
}
if passwordField.text != nil {
destination.passwordField = passwordField.text
}
}
}
}
@IBAction func signInTapped(sender: Any){
if let email = emailField.text, let password = passwordField.text {
FIRAuth.auth().signIn(withEmail: email, password: password, completion: { (user,error) in
if error == nil{
if let user = user {
self.userUid = user.uid
self.goToCreateUserVC()
}
}else{
self.goToCreateUserVC()
}
});
}
}
}
答案 0 :(得分:1)
首先,更新您的方法:Auth.auth()。signIn
然后,从documentation: 在Podfile中安装依赖项:
pod 'Firebase/Auth'
在方法应用程序中初始化Firebase对象:didFinishLaunchingWithOptions:
FirebaseApp.configure()