Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [StudyBuddy.SignUpViewController signUpButton:]: unrecognized selector sent to instance 0x7fac5e061b80'
- import UIKit
- import Firebase
- import CoreData
- import CoreLocation
- class SignUpViewController: UIViewController {
- @IBOutlet weak var emailField: UITextField!
- @IBOutlet weak var passwordField: UITextField!
- @IBOutlet weak var confirmPasswordField: UITextField!
- override func viewDidLoad() {
- super.viewDidLoad()
- if let user = FIRAuth.auth()?.currentUser {
- }
- // Do any additional setup after loading the view.
- }
- override func didReceiveMemoryWarning() {
- super.didReceiveMemoryWarning()
- // Dispose of any resources that can be recreated.
- }
- @IBAction func signupButton(sender: AnyObject)
- {
- if self.emailField.text == "" || self.passwordField.text == "" {
- let alertController = UIAlertController(title: "Oops!", message: "Please enter a valid username and password", preferredStyle: .Alert)
- let defaultAction = UIAlertAction(title: "Ok", style: .Cancel, handler: nil)
- self.presentViewController(alertController, animated: true, completion: nil)
- }
- else if self.confirmPasswordField.text != self.passwordField.text {
- let passwordAlert = UIAlertController(title: "Oops!", message: "Passwords do not match", preferredStyle: .Alert)
- let passwordAction = UIAlertAction(title: "Ok", style: .Cancel, handler: nil)
- self.presentViewController(passwordAlert, animated: true, completion: nil)
- }
- else {
- FIRAuth.auth()?.createUserWithEmail(emailField.text!, password: passwordField.text!, completion: {(user, error) in
- if error == nil {
- self.performSegueWithIdentifier("goToSignUp", sender: sender)
- }
- else {
- 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)
- let createAction = UIAlertAction(title: "Ok", style: .Cancel, handler: nil)
- self.presentViewController(createAlert, animated: true, completion: nil)
- }
- })
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement