[英]The operation could not complete. (Alamofire.AFError error 9.)
On a network request handled by Alamofire, I often get this error:在 Alamofire 处理的网络请求中,我经常收到此错误:
The operation could not complete.
操作无法完成。 (Alamofire.AFError error 9.)
(Alamofire.AFError 错误 9。)
Has anyone a clue about what this error 9 is?有没有人知道这个错误 9 是什么?
I suppose AFError
being an enum and conforming to protocol Error
, this error 9 could be the raw value of the createURLRequestFailed(error:)
case (which is the 10th case in this enum).我想
AFError
是一个枚举并符合协议Error
,这个错误 9 可能是createURLRequestFailed(error:)
案例(这是这个枚举中的第 10 个案例)的原始值。 AFError enumeration reference AFError 枚举参考
I then implemented some delegate methods in EventMonitor
, like然后我在
EventMonitor
实现了一些委托方法,比如
public func request(_ request: Request, didFailToCreateURLRequestWithError error: AFError)
public func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: AFError?)
public func request(_ request: UploadRequest, didFailToCreateUploadableWithError error: AFError)
public func request(_ request: Request, didFailTask task: URLSessionTask, earlyWithError error: AFError)
but none of these seem to be triggered for this error (especially the first one, which seemed a good fit).但是这些似乎都没有被这个错误触发(尤其是第一个,这似乎很合适)。
How can I debug this error and find the root cause of the issue?如何调试此错误并找到问题的根本原因?
I found this, where you can debug this by casting the AFError to an NSError or URLError and from there on debug what it is that actually went wrong.我发现了这个,您可以通过将 AFError 转换为 NSError 或 URLError 来调试它,然后从那里调试实际出错的地方。
https://github.com/Alamofire/Alamofire/issues/3068 https://github.com/Alamofire/Alamofire/issues/3068
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.