2

I've ran into this issue and have been trying to solve it for a few days now and it seems everything I try it creates more errors. I'm having problems creating a user with this function use FIRAuth and its telling me to add in a ; right before in, but it doesn't fix the problem.

Picture of Errors:

Picture of Errors

func handleRegistration() {
        guard let email = emailTextField.text, let password = passTextField.text
            else {
                print("Form is not Valid")
                return
        }



        FIRAuth.auth()?.createUser(withEmail: email, password: password, completion: FIRUser?, error) in

         if error != nil {
            print("Error")
            return
        }

        print("Login Successful")
    }
AL.
  • 36,815
  • 10
  • 142
  • 281
Darin Wilson
  • 169
  • 1
  • 2
  • 9
  • Instead of adding screenshots of your code, please add the actual code to the question. To capture the error message, right click on the red indicator and "Reveal in Issue Navigator". – Frank van Puffelen Oct 05 '16 at 15:27
  • you should watch this https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Closures.html, explain how closures work, @Dravidian is right – Damien Oct 05 '16 at 15:38

1 Answers1

4

Try this :-

FIRAuth.auth()?.createUser(withEmail: email, password: password, completion: {(user, error) in

     if error != nil {
        print("Error")
        return
    }else{
        print("Login Successful")
        return 
   }
})
Dravidian
  • 9,945
  • 3
  • 34
  • 74
  • Accept and upvote the answer if it solved your issue :) Happy Coding. – Dravidian Oct 05 '16 at 15:33
  • That creates more errors :-/ 10 more to be exact. everything else I try seems to break my UIcolor(s) code including this fix :-/ – Darin Wilson Oct 05 '16 at 15:33
  • I cannot say anything about other error's but i am definite of this as answer. :) Avoid fanning out question in comments. Post another question or try to debug yourself – Dravidian Oct 05 '16 at 15:36