From a2bcbe180462e971a93400dd06bb82f6d1b653ed Mon Sep 17 00:00:00 2001 From: Bob Sun Date: Wed, 22 Feb 2017 12:56:06 +0800 Subject: [PATCH] show error alert window when cannot decrypt password --- .../PasswordDetailTableViewController.swift | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pass/Controllers/PasswordDetailTableViewController.swift b/pass/Controllers/PasswordDetailTableViewController.swift index e826485..a0883e0 100644 --- a/pass/Controllers/PasswordDetailTableViewController.swift +++ b/pass/Controllers/PasswordDetailTableViewController.swift @@ -80,11 +80,14 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni do { self.password = try self.passwordEntity!.decrypt()! } catch { - 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 - self.navigationController!.popViewController(animated: true) - })) - self.present(alert, animated: true, completion: nil) + DispatchQueue.main.async { + 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 + self.navigationController!.popViewController(animated: true) + })) + self.present(alert, animated: true, completion: nil) + } + return } let password = self.password!