我尝试通过下面的代码将 URL 加载到 webview 中,每次尝试 loadRequest 时,都会失败并出现上述错误。
@IBOutlet weak var wb: UIWebView!
func openCheckoutPage(landingUrl:String,token:String)
{
let url:String = "\(landingUrl)&token=\(token)"
self.wb.loadRequest(NSURLRequest(URL: NSURL(string: url)!))
}
请记住,我已经在我的 info.plist 中添加了适当的 NSAppTransportSecurity key
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSExceptionDomains</key>
<dict>
<key>walgreens.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
最佳答案
问题是,作为加载该 URL 的一部分,我们需要加载未包含在 walgreens.com
下的其他 URL。但您已关闭任意加载,因此它们无法加载。
关于ios - NSURLSession/NSURLConnection HTTP 加载失败(kCFStreamErrorDomainSSL,-9802)错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33307239/