From 36e2a96df28a660a45ab13b4e87de2fcb600b812 Mon Sep 17 00:00:00 2001 From: Bob Sun Date: Tue, 28 Feb 2017 17:10:53 +0800 Subject: [PATCH] Check mail service is ready before open VC --- pass/Controllers/BasicStaticTableViewController.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pass/Controllers/BasicStaticTableViewController.swift b/pass/Controllers/BasicStaticTableViewController.swift index 8ede6a5..e7e184a 100644 --- a/pass/Controllers/BasicStaticTableViewController.swift +++ b/pass/Controllers/BasicStaticTableViewController.swift @@ -92,7 +92,9 @@ class BasicStaticTableViewController: UITableViewController, MFMailComposeViewCo case "mailto": let urlComponents = URLComponents(string: link)! let subject = urlComponents.queryItems![0].value ?? "" - sendEmail(toRecipients: [urlComponents.path], subject: subject) + if MFMailComposeViewController.canSendMail() { + sendEmail(toRecipients: [urlComponents.path], subject: subject) + } case "http", "https": let svc = SFSafariViewController(url: URL(string: link)!, entersReaderIfAvailable: false) self.present(svc, animated: true, completion: nil)