ios - 如何在 iOS 中修复 ‘TIC SSL Trust Error’?

标签 ios objective-c iphone ssl-certificate

当我尝试使用网络服务登录应用程序时。 我还设置了我的 plist-file 如下

enter image description here

我收到以下错误。 此错误显示在我的控制台上

TIC SSL Trust Error [5:0x1c017fbc0]: 3:0
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
Task <E0C414FF-98C7-4E6B-876F-B9006465C8FD>.<1> HTTP load failed (error code: -1200 [3:-9802]

最佳答案

IKKA - Swift 4.2 版本中的答案

extension CustomViewController: URLSessionDelegate {
    func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
        if (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodClientCertificate) {
            completionHandler(.rejectProtectionSpace, nil)
        }
        if (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust) {
            let credential = URLCredential(trust: challenge.protectionSpace.serverTrust!)
            completionHandler(.useCredential, credential)
        }
    }
}

关于ios - 如何在 iOS 中修复 ‘TIC SSL Trust Error’?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46974527/

相关文章:

ios - Xcode ViewDidLoad 动画 Swift

ios - JSON解析后,-viewForAnnotation在MKMapView上仅显示一个注解

iphone - 为 iPhone 上的 Core Data 程序创建唯一 ID

objective-c - 是否有等效于 C#'s ' var' 关键字的 Objective-C?

ios - 创建加载循环

ios - iPhone 在弹出窗口中出现滚动问题

iphone - 是否可以通过编程方式将 iPhone 联系人添加到手机收藏夹中?

ios - 如何为 4 英寸 iOS 设备指定图像

ios - TouchId 身份验证 - 删除警报

ios - mylocationButton 为什么不更新我的位置?