Mar*_*coz 9 ios swift urlsession urlsessiontask
我用来获取.mjpeg视频源的服务器中有些变化.
现在我收到这个错误:
TIC TCP Conn失败[5:0x1d4361380]:3:-9802 Err(-9802)
TIC TCP Conn失败[6:0x1c0177a00]:3:-9800 Err(-9800)
TIC TCP Conn失败[7:0x1d4361440]:3:-9800 Err(-9800)
NSURLSession/NSURLConnection HTTP加载失败(kCFStreamErrorDomainSSL,-9800)
任务<2B8346B5-6BB2-4B92-B311-554410CBF92F>.<1> HTTP加载失败(错误代码:-1200 [3:-9800])
任务<2B8346B5-6BB2-4B92-B311-554410CBF92F>.<1>完成错误 - 代码:-1200
这是我收到错误的代码:
open func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
var credential: URLCredential?
var disposition: Foundation.URLSession.AuthChallengeDisposition = .useCredential
// Getting the authentication if stream asks it
if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust {
if let trust = challenge.protectionSpace.serverTrust {
credential = URLCredential(trust: trust)
disposition = .useCredential
}
} else if let onAuthentication = authenticationHandler {
(disposition, credential) = onAuthentication(challenge)
}
completionHandler(disposition, credential)
}
Run Code Online (Sandbox Code Playgroud)
我已经将NSAllowsArbitraryLoads设置为true:
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Run Code Online (Sandbox Code Playgroud)
要获取.mjpeg我正在使用MjpegStreamLib的代码.
有什么不对?
| 归档时间: |
|
| 查看次数: |
8931 次 |
| 最近记录: |