简体   繁体   English

操作无法完成。 (Alamofire.AFError 错误 9。)

[英]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.

相关问题 错误:可选(Alamofire.AFError.invalidURL(“”)) - Error: Optional(Alamofire.AFError.invalidURL(“”)) Alamofire+Combine:如何从 AFError 中获取自定义错误类型 - Alamofire+Combine: how to get custom error type out of AFError Alamofire.AFError.ResponseSerializationFailureReason.jsonSerializationFailed(错误域=NSCocoaErrorDomain 代码=3840 - Alamofire.AFError.ResponseSerializationFailureReason.jsonSerializationFailed(Error Domain=NSCocoaErrorDomain Code=3840 Swift 5 &amp; Alamofire 5:GET 方法错误:Alamofire.AFError.URLRequestValidationFailureReason.bodyDataInGETRequest(22 bytes) - Swift 5 & Alamofire 5 : GET method ERROR: Alamofire.AFError.URLRequestValidationFailureReason.bodyDataInGETRequest(22 bytes) Alamofire:responseSerializationFailed(Alamofire.AFError.ResponseSerializationFailureReason.inputDataNilOrZeroLength) - Alamofire: responseSerializationFailed(Alamofire.AFError.ResponseSerializationFailureReason.inputDataNilOrZeroLength) Alamofire - Alamofire.AFError.responseSerializationFailed - Xcode 8 - Alamofire - Alamofire.AFError.responseSerializationFailed - Xcode 8 使用Flickr API时Alamofire AFError - Alamofire AFError when work with Flickr API “结果”类型的 Alamofire 值<any, aferror> ' 没有成员 'isSuccess' (Swift 5)</any,> - Alamofire Value of type 'Result<Any, AFError>' has no member 'isSuccess' (Swift 5) viewController转换完成后,removeFromSuperview。 - removeFromSuperview after viewController transition is complete. 失败:responseSerializationFailed(原因:Alamofire.AFError.ResponseSerializationFailureReason.inputDataNilOrZeroLength) - FAILURE: responseSerializationFailed(reason: Alamofire.AFError.ResponseSerializationFailureReason.inputDataNilOrZeroLength)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM