【问题标题】:HTTP load request is not working in iOS12HTTP 加载请求在 iOS12 中不起作用
【发布时间】:2018-10-22 12:00:14
【问题描述】:

我有一个应用程序,它使用“http://maps.google.com”URL 打开 web 视图中两个位置之间的方向。但它不适用于iOS12。并且还启用了 App 传输安全 plist 值中的异常域。即使它不起作用。

【问题讨论】:

  • 给我们看一些代码。发生什么了?您收到错误消息吗?
  • 更新设备,现已发布ios12

标签: ios swift ios12


【解决方案1】:

请尽快将您的 iOS 12 更新为最新版本。

iOS 12 beta 版本与 wkwebview 存在 CORS 问题。

Refer to this link.

现在已经修复了。

【讨论】:

    【解决方案2】:

    对我来说,这个问题是由 WKWebView 的服务器信任检查引起的。

    要解决此问题,我必须处理质询身份验证回调并返回服务器信任凭据。

    斯威夫特 4

    func webView(_ webView: WKWebView, 
        didReceive challenge: URLAuthenticationChallenge, 
        completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) 
    {
        if(challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust)
        {
            let cred = URLCredential(trust: challenge.protectionSpace.serverTrust!)
            completionHandler(.useCredential, cred)
        }
        else
        {
            completionHandler(.performDefaultHandling, nil)
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-07
      • 2023-03-20
      • 1970-01-01
      • 2020-06-11
      • 1970-01-01
      相关资源
      最近更新 更多