When a user creates an account I would like the time and date they did it registered on the server. I am getting the following error when trying to do this.
Can only store objects of type NSNumber, NSString, NSDictionary, and NSArray.' .... libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
@IBAction func registerTapped(_ sender: Any) {
let namec = nameTextField.text
if let email = emailTextField.text, let pass = passwordTextField.text, let name = namec?.capitalized {
FIRAuth.auth()?.createUser(withEmail: email, password: pass, completion: { (user, error) in
if user != nil {
//user found
let interval = NSDate().timeIntervalSince1970
let date = NSDate(timeIntervalSince1970: interval)
self.refD?.child("Users").child((user?.uid)!).setValue(["Email": email, "Name": name, "User Created": date])
print("User Created And Added To Database", email, name, date)
self.performSegue(withIdentifier: "registertologin", sender: self)
}
}