我正在尝试通过单击拨打电话WebView
但不起作用。
func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool {
if navigationType == UIWebViewNavigationType.LinkClicked {
if (request.URL?.absoluteString!.rangeOfString("tel://") != nil) {
var phone : String = request.URL!.absoluteString!
println(phone)
var url:NSURL? = NSURL(string: phone)
UIApplication.sharedApplication().openURL(url!)
return false
} else {
return true
}
}
return true
}
提前致谢!