标签云

微信群

扫码加入我们

WeChat QR Code

I'm trying to have it so when a user creates an account... if their email hasn't been used before an Alert box appears saying "Accountcreated" and if the email is already in created (on Parse) then an alert should appear notifying the user.I can't seem to get my code to do both..only display one message. What am I doing wrong here?Thanks!func createNewUser() {let newUser = PFUser()newUser.email = emailSignUp.textnewUser.username = emailSignUp.textnewUser.password = passwordSignUp.textnewUser.signUpInBackgroundWithBlock { ( success: Bool, error: NSError?) -> Void in if newUser.username != nil {let alert: UIAlertController = UIAlertController(title: "Account created", message: "Please confirm your email", preferredStyle: .Alert)let okButton = UIAlertAction(title: "OK", style: .Default) { action -> Void in}alert.addAction(okButton)self.presentViewController(alert, animated: true, completion: nil) } else {let alert: UIAlertController = UIAlertController(title: "Email already registered", message: "Please enter a different email", preferredStyle: .Alert)let okButton = UIAlertAction(title: "OK", style: .Default, handler: nil)alert.addAction(okButton)self.presentViewController(alert, animated: true, completion: nil)}}}