Advertisement
Guest User

Untitled

a guest
Aug 5th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. [StudyBuddy.SignUpViewController signUpButton:]: unrecognized selector sent to instance 0x7fac5e061b80'
  2.  
  3. import UIKit
  4. import Firebase
  5. import CoreData
  6. import CoreLocation
  7.  
  8. class SignUpViewController: UIViewController {
  9. @IBOutlet weak var emailField: UITextField!
  10. @IBOutlet weak var passwordField: UITextField!
  11. @IBOutlet weak var confirmPasswordField: UITextField!
  12.  
  13. override func viewDidLoad() {
  14. super.viewDidLoad()
  15. if let user = FIRAuth.auth()?.currentUser {
  16.  
  17.  
  18.  
  19. }
  20. // Do any additional setup after loading the view.
  21. }
  22.  
  23. override func didReceiveMemoryWarning() {
  24. super.didReceiveMemoryWarning()
  25. // Dispose of any resources that can be recreated.
  26. }
  27. @IBAction func signupButton(sender: AnyObject)
  28. {
  29. if self.emailField.text == "" || self.passwordField.text == "" {
  30.  
  31. let alertController = UIAlertController(title: "Oops!", message: "Please enter a valid username and password", preferredStyle: .Alert)
  32. let defaultAction = UIAlertAction(title: "Ok", style: .Cancel, handler: nil)
  33. self.presentViewController(alertController, animated: true, completion: nil)
  34.  
  35. }
  36.  
  37. else if self.confirmPasswordField.text != self.passwordField.text {
  38.  
  39. let passwordAlert = UIAlertController(title: "Oops!", message: "Passwords do not match", preferredStyle: .Alert)
  40. let passwordAction = UIAlertAction(title: "Ok", style: .Cancel, handler: nil)
  41.  
  42. self.presentViewController(passwordAlert, animated: true, completion: nil)
  43. }
  44.  
  45. else {
  46.  
  47. FIRAuth.auth()?.createUserWithEmail(emailField.text!, password: passwordField.text!, completion: {(user, error) in
  48.  
  49. if error == nil {
  50. self.performSegueWithIdentifier("goToSignUp", sender: sender)
  51.  
  52. }
  53. else {
  54. let createAlert = UIAlertController(title: "There was a problem", message: "There was a problem creating your account, please check the information you provided and try again", preferredStyle: .Alert)
  55. let createAction = UIAlertAction(title: "Ok", style: .Cancel, handler: nil)
  56. self.presentViewController(createAlert, animated: true, completion: nil)
  57. }
  58.  
  59. })
  60. }
  61.  
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement