show error alert window when cannot decrypt password

This commit is contained in:
Bob Sun 2017-02-22 12:56:06 +08:00
parent 7b00435658
commit a2bcbe1804
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -80,12 +80,15 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
do { do {
self.password = try self.passwordEntity!.decrypt()! self.password = try self.passwordEntity!.decrypt()!
} catch { } catch {
DispatchQueue.main.async {
let alert = UIAlertController(title: "Cannot Show Password", message: error.localizedDescription, preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "Cannot Show Password", message: error.localizedDescription, preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: {(UIAlertAction) -> Void in alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: {(UIAlertAction) -> Void in
self.navigationController!.popViewController(animated: true) self.navigationController!.popViewController(animated: true)
})) }))
self.present(alert, animated: true, completion: nil) self.present(alert, animated: true, completion: nil)
} }
return
}
let password = self.password! let password = self.password!
self.setTableData() self.setTableData()