Ios 尝试为多个视图控制器设置Firebase身份验证时出错

Ios 尝试为多个视图控制器设置Firebase身份验证时出错,ios,swift,xcode,firebase,firebase-authentication,Ios,Swift,Xcode,Firebase,Firebase Authentication,我正在尝试创建一个Firebase身份验证方法,供用户创建帐户。但是,我有多个视图控制器,要求我在处理Firebase Auth“createUser”函数之前保存用户信息。所以我为它编了一本字典。我也在使用Swift 这就是我所说的我有多个创建帐户视图控制器的方法 // After Email is entered, next button is tapped to take user to second step of sign up process @IBAction func next

我正在尝试创建一个Firebase身份验证方法,供用户创建帐户。但是,我有多个视图控制器,要求我在处理Firebase Auth“createUser”函数之前保存用户信息。所以我为它编了一本字典。我也在使用Swift

这就是我所说的我有多个创建帐户视图控制器的方法

 // After Email is entered, next button is tapped to take user to second step of sign up process
@IBAction func nextButtonTapped(_ sender: UIButton) {
    AppDelegate.shared.userInformation ["createEmail"] = emailTextField.text

然后,我在应用程序委托中添加了一个字典,以在激活Firebase“createUser”方法之前保存用户信息

 // Instance of AppDelegate
static let shared: AppDelegate = UIApplication.shared.delegate as! AppDelegate
// Dictionary for user information
var userInformation: Dictionary<String, Any> = [:]
最后是“名称和密码”视图控制器。这是我希望从最后一个视图控制器保存的电子邮件也能到位的地方。我尝试调用存储在字典中的所有保存信息,以便实现Firebase Auth.Auth().createUser方法

IBAction func nextButtonTapped(_ sender: UIButton) {
    AppDelegate.shared.userInformation["name"] = nameTextField.text
    AppDelegate.shared.userInformation["password"] = createPassWordTextField.text

    let createEmail = AppDelegate.shared.userInformation["createEmail."]
    let name = AppDelegate.shared.userInformation["name"]
    let password = AppDelegate.shared.userInformation["password"]

    Auth.auth().createUser(withEmail: createEmail, password: password ) { (user, error) in
        if error == nil && user != nil {
            print("User Created!")
            // If user is created go to Welcome Page
            self.performSegue(withIdentifier: "goToWelcomeVC", sender: self)
        } else {
            print("error creating User")
之后,我想用户的帐户被创建。然后他们将被带到欢迎页面,然后是主页。然而,我似乎得到了这个错误。我是不是碰巧把字典弄错了?对于我的登录视图控制器,它非常简单。正如你在下面看到的

 //Login Button

@IBAction func loginButtonTapped(_ sender: UIButton) {
  // Signing in User with Email and Password using Firebase
    if let email = emailTextField.text, let password = passwordTextField.text {

        Auth.auth().signIn(withEmail: email, password: password) { (user, error) in
            // check if user isnt nil
            if user != nil {
                print("Login Successful")
                // user is found, go to home screen
                self.performSegue(withIdentifier: "goToHomeVC", sender: self)
            } else {
                print("loginError")
我试着用注册视图控制器做同样的事情,让email、password和name=UITextField.text。有人能帮我做点什么吗

编辑*这是我收到的错误。


谢谢。

我不知道这是否能解决您的问题,但是
让createEmail=AppDelegate.shared.userInformation[“createEmail.”]
正如您在这里看到的,您的密钥与第一个密钥不同,在第一个密钥中,您将信息保存为
[“createEmail”]
,最后没有点。

添加代码而不是屏幕截图,我的抱歉,伙计。我认为截图是让每个人直观地看到我试图解释的内容和我看到的内容的最好方式。你想让我删除所有照片并添加代码吗?保持原样,删除代码截图并添加代码谢谢。我已经更新了上面的问题。谢谢你回复我,伙计。我修正了那个打字错误,但是我仍然得到同样的错误。我将更新显示错误的问题。感谢您指出这一点。您是否也可以显示您收到的错误,并在发出请求时添加一个断点,以便我们可以查看您的变量值。@Clint请尝试“Auth.Auth().createUser(使用电子邮件:createEmail as!String,password:password)”这一操作!!非常感谢。它还希望我将密码更改为(password:password as!String)。好的,那么也批准答案;)