条件序列(Parse和Swift)

时间:2014-12-18 22:14:06

标签: swift parse-platform segue

我正在尝试根据用户是否成功注册,从一个视图控制器到另一个视图控制器执行条件segue。我在这个项目中使用Parse框架。使用不应返回错误的新登录数据单击按钮时,应用程序崩溃。使用已存在的登录数据单击按钮时,应返回错误,并且应用程序崩溃。

这是我的代码:

import UIKit

class SignUpController: UIViewController {


@IBOutlet var emailField: UITextField!

@IBOutlet var passField: UITextField!


override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

@IBAction func submitButton(sender: AnyObject) {

    var user = PFUser()
    user.username = emailField.text
    user.password = passField.text

    user.signUpInBackgroundWithBlock {
        (succeeded: Bool!, error: NSError!) -> Void in
        if error == nil {
            self.performSegueWithIdentifier("SignIn", sender: self)

        } else {

            println("failure")

        }
    }
}
}

0 个答案:

没有答案
相关问题