title: swift - Terminating app due to uncaught exception '(child:) Must be a non-empty string and not contain '.' '#' '$' '[' or ']''
body: <pre><code>@IBAction func NextButton(_ sender: Any) {
  
  
      //self.nextButton.isEnabled = false
  
  
          if emailTF.text != "" &amp;&amp; passwordTF.text != "" {
  
  
              AuthProvider.Instance.registerButton(withEmail: emailTF.text!, password: passwordTF.text!, loginHandler: { (message) in
  
                  if message != nil {
                      self.alertTheUser(title:"Problem With Authentication", message: message!);
  
                      self.nextButton.isEnabled = true
  
  
                  } else {
  
  
  
                      let userID = FIRAuth.auth()?.currentUser?.uid
  
                      let userEmail = self.emailTF.text!
                      let userPassword = self.passwordTF.text!
  
  
  
                      //self.ref.child("UserEmails").child(userEmail).setValue(["UID": userID, "Email": userEmail,"Password": userPassword])
  
  
  // app does not crash when I run the below reference to database.
  
  
                      self.ref.child("Users").child(userID!).setValue(["UID": userID,"Email":userEmail,"Password": userPassword])
  
  // app crashes when I run the below reference to database.
  
                      self.ref.child("Email").child(userEmail).setValue(["UID": userID,"Email": userEmail,"Password": userPassword])
  
                      //self.nextButton.isEnabled = true
  
  
                      self.performSegue(withIdentifier: self.to_Select_Account_Segue, sender: nil);
                                         }
  </code></pre>
  
  <p>App work fines when I run </p>
  
  <pre><code>// app does not crash when I run the below reference to database.
                          self.ref.child("Users").child(userID!).setValue(["UID": userID,"Email":userEmail,"Password": userPassword])
  </code></pre>
  
  <p>Though when I run this code it crashes?</p>
  
  <pre><code>// app crashes when I run the below reference to database.
                          self.ref.child("Email").child(userEmail).setValue(["UID": userID,"Email": userEmail,"Password": userPassword])
  </code></pre>