可重现错误的 iOS 版本:10.3.2
代码在 iOS 10.3.1 及更早版本上正常运行
每当我尝试在 UIWebView 上加载 youtube 视频 url 时,都会出现以下错误:
The operation could not be completed. (NSURLErrorDomain error -999.)
请求加载很简单,UIWebView
如下所示:
// ...
let urlRequest = URLRequest(url: url)
self.webView.loadRequest(urlRequest)
// URL is: https://www.youtube.com/watch?v=hntVmN2aK8k
func webView(_ webView: UIWebView, didFailLoadWithError error: Error) {
print(error.localizedDescription) // The operation could not be completed. (NSURLErrorDomain error -999.)
}