Alamofire.request(.GET, NetConfig.ActionSaveEditCustomerInfo, parameters: parameters, encoding: .URLEncodedInURL, headers: header).responseJSON() {
response in
if response.result.isSuccess {
print(response.result.value)
if let json = response.result.value as? Dictionary<String,String> {
if json["status"] == "1" {
print("ok")
let alertOk = UIAlertController(title: "demoOk", message: "Ok", preferredStyle: .Alert)
let okAction = UIAlertAction(title: "OK", style: .Default) {
(action) in
alertOk.dismissViewControllerAnimated(true, completion: nil)
}
alertOk.addAction(okAction)
self.presentViewController(alertOk, animated: true, completion: nil)
}else {
let alertFail = UIAlertController(title: "Failure", message: "failure", preferredStyle: .Alert)
let okAction = UIAlertAction(title: "OK", style: .Default) {
(action) in
alertFail.dismissViewControllerAnimated(true, completion: nil)
}
alertFail.addAction(okAction)
self.presentViewController(alertFail, animated: true, completion: nil)
}
}
}else {
print("error info : \(response.result.error)")
}
UIApplication.sharedApplication().networkActivityIndicatorVisible = false
self.saveBar.enabled = true
}
}
在此代码之后,警报将显示在屏幕上,然后我的第一个http
请求必须失败,并且我收到此错误:
NSLocalizedDescription = The network connection was lost
我不确定是什么导致了这一点。