iOS安全例外(-9813)仅来自Kingfisher图书馆的电话

时间:2017-08-16 06:34:22

标签: ios swift security kingfisher

我得到这些错误

[] nw_coretls_callback_handshake_message_block_invoke_3 tls_handshake_continue: [-9812]
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)

尝试从具有不受信任证书的Web服务加载图像时。我已经将我的项目info.plist配置为 this它正在为#34;正常"对Web服务的请求。但是,只要Kingfisher-Lib提出请求,我就会收到此错误。这是为什么?

1 个答案:

答案 0 :(得分:0)

Kingfisher似乎使用自定义方式访问网址。解决方案是在下载器中手动将主机配置为受信任的:

let downloader = KingfisherManager.shared.downloader //Downloader needs to be configured to accept untrusted certificates
    downloader.trustedHosts = Set(["your_untrusted_certificate_host"])
imageView.kf.setImage(with: URL(string: "\(applicationSession.environment.systemUrl!)\(path)"), placeholder: #imageLiteral(resourceName: "noImageImage"), options: [.requestModifier(modifier), .downloader(downloader)])