I am trying to create a Firebase Auth method for users to create an account. However I have multiple view controllers that required me to save the users information before I could process the Firebase Auth 'createUser' function. So I created a dictionary for that. I am also using Swift.
This is what I meant when I said I have more than one create an account view controller.
I then added created a dictionary in the App Delegate to save the users information before the Firebase 'createUser' method is activated.
// Instance of AppDelegate
static let shared: AppDelegate = UIApplication.shared.delegate as! AppDelegate
// Dictionary for user information
var userInformation: Dictionary<String, Any> = [:]
Here is the code for the "enter your email address" view controller.
// 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
And last for the "Name and Password" View controller. This is where I would like the email that was saved from the last view controller to come into place as well. I tried calling all of the saved information I stored in the dictionary so I can implenment the Firebase Auth.auth().createUser method.
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")
After I would like the user's account to be created. Then they will be taken to the welcome page, then the home page. However I seem to be getting this error. Did I happen to do the dictionary incorrect? For my login view controller it was very simple. as you can see below.
//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")
I tried doing the same thing with the sign up view controllers by letting email, password, and name = UITextField.text. Can someone please assist me on what I did wrong here?
Edit* Here is the error I am receiving.
Thank you.
我不知道这是否会解决您的问题,但是let createEmail = AppDelegate.shared.userInformation["createEmail."]
正如您在此处看到的那样,您的密钥与第一个不同,您将信息保存为["createEmail"]
没有点。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.