'AuthDataResultCallback?'无法将类型((User,_)->()'的值转换为预期的参数类型

时间:2018-10-26 03:33:05

标签: xcode

我一直在寻找google,ios论坛,reddit
关于这个错误。但是我似乎找不到任何解决方案。
我一直在关注本教程link
,但出现
错误 AuthDataResultCallback?
我也查看了stackoverflow,并尝试了所有相关内容,但无法摆脱该错误。

//
//  ViewController.swift
//  transit
//
//  Created by transit on 2018/10/26.
//  Copyright © 2018 transit. All rights reserved.
//

import UIKit

//importing firebase
import Firebase

class ViewController: UIViewController {
    
    //textfields for email and password
    @IBOutlet weak var textFieldEmail: UITextField!
    @IBOutlet weak var textFieldPassword: UITextField!
    
    //label for displaying message
    @IBOutlet weak var labelMessage: UILabel!
    
    
    //button for registration
    @IBAction func buttonRegister(sender: UIButton){
        
        let email = textFieldEmail.text
        let password = textFieldPassword.text
        
        Auth.auth().createUser(withEmail: email!, password: password!, completion: { (user: User, error) in
            if error == nil {
                self.labelMessage.text = "You are Successfully registered"
            }else{
                self.labelMessage.text = "Registration Failed. Please Try Again"
            }
        })
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        
        //initialising Firebase
        FirebaseApp.configure()
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    
    
}

起初建议我将FIRAuth.auth更改为Auth.auth,我做了
xcode本身建议的所有FIX
由于错误仍然无法执行应用。
我正在使用Xcode 10.0和Swift Verson 4.2

0 个答案:

没有答案