Check mail service is ready before open VC

This commit is contained in:
Bob Sun 2017-02-28 17:10:53 +08:00
parent 48d1ab34d2
commit 36e2a96df2
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -92,7 +92,9 @@ class BasicStaticTableViewController: UITableViewController, MFMailComposeViewCo
case "mailto": case "mailto":
let urlComponents = URLComponents(string: link)! let urlComponents = URLComponents(string: link)!
let subject = urlComponents.queryItems![0].value ?? "" let subject = urlComponents.queryItems![0].value ?? ""
sendEmail(toRecipients: [urlComponents.path], subject: subject) if MFMailComposeViewController.canSendMail() {
sendEmail(toRecipients: [urlComponents.path], subject: subject)
}
case "http", "https": case "http", "https":
let svc = SFSafariViewController(url: URL(string: link)!, entersReaderIfAvailable: false) let svc = SFSafariViewController(url: URL(string: link)!, entersReaderIfAvailable: false)
self.present(svc, animated: true, completion: nil) self.present(svc, animated: true, completion: nil)