Swift - 通过url地址打开web页面
(本文代码已升级至Swift3)
let urlString = "http://hangge.com" if let url = URL(string: urlString) { //根据iOS系统版本,分别处理 if #available(iOS 10, *) { UIApplication.shared.open(url, options: [:], completionHandler: { (success) in }) } else { UIApplication.shared.openURL(url) } }