我有一个帮助方法,在我的实际视图控制器上提示alertviewcontroller。但是,如果这发生在segue期间。我的segue被取消了。有什么想法吗?
AlamoHelper.request(.POST, url: AppDelegate.kbaseUrl + "users/signin", parameters: ["email": String(emailTextField.text!), "password": String(passwordTextField.text!)])
.responseJSON {
response in
switch (response.result) {
case .Success:
var json = JSON(response.result.value!)
if (json["status"] != 200){
AppDelegate.removeCookies()
AppDelegate.isLoggedIn = false
} else {
self.performSegueWithIdentifier("showTabBarController", sender: self)
self.emailTextField.text = ""
self.passwordTextField.text = ""
self.appDelegate.storeCookies()
AppDelegate.isLoggedIn = true
self.addDeviceToken()
}
break
case .Failure:
break
}
}
在我的助手中,我显示警报控制器的部分是这个
if json["status"].intValue == 500 {
let alert = UIAlertController(title: "Unknown error", message: "Please try again later. If problem persists, please contact Offpeak support", preferredStyle: .Alert)
let okAction = UIAlertAction(title: "Ok", style: .Cancel, handler: nil)
alert.addAction(okAction)
AlamoHelper.getCurrentViewController().presentViewController(alert, animated: true, completion: nil)
}