我在WebView中添加了一个带有youtube视频的框架 . 它工作正常 .
webView.loadHTMLString("<html><head><title>.</title><style>body,html,iframe{margin:0;padding:0;}</style></head><body><iframe width=\"" + String(describing: w) + "\" height=\"" + String(describing: h) + "\" src=\"" + livestream.Url + "?&playinline=1\" frameborder=\"0\" allowfullscreen></iframe></body></html>", baseURL: nil)
然后我为livestream.com视频做了同样的事情 . 我收到了这些错误:
-
CFNetwork SSLHandshake失败(-9806)
-
SURLSession / NSURLConnection HTTP加载失败(kCFStreamErrorDomainSSL,-9806)
-
收到内存警告 .
我还在Info.plist文件中添加了数据:
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>livestream.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>