Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FIRAuth.auth()?.createUserWithEmail(self.emailTextField.text, password: self.passwordTextField.text,
- withValueCompletionBlock: { error, result in
- if error != nil {
- //Change location of alertcontroller
- let alertController = UIAlertController(title: "Error", message: error?.localizedDescription, preferredStyle: .Alert)
- let defaultAction = UIAlertAction(title: "Ok", style: .Cancel, handler: nil)
- alertController.addAction(defaultAction)
- } else {
- let uid = result["uid"] as? String
- println("Successfully created user account with uid: \(uid)")
- // Create a new user dictionary accessing the user's info
- // provided by the authData parameter
- let newUser = [
- "provider": authData.provider,
- "displayName": authData.providerData["displayName"] as? NSString as? String,
- "firstName": firstnameTextField.text,
- "lastName": lastnameTextField.text
- ]
- // Create a child path with a key set to the uid underneath the "users" node
- // This creates a URL path like the following:
- // - https://<YOUR-FIREBASE-APP>.firebaseio.com/users/<uid>
- ref.childByAppendingPath("users")
- .childByAppendingPath(authData.uid).setValue(newUser)
- //
- // let firstName = firstnameTextField.text
- // let lastName = lastnameTextField.text
- // let user: NSDictionary = ["firstName": firstName!, "lastName": lastName! ]
- //
- //
- //
- // //add firebase child node
- // let profile = firebase.ref.childByAppendingPath(firstName!)
- //
- // // Write data to Firebase
- // profile.setValue(user)
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement