域 CFStreamErrorHTTP 中的 CFNetwork 错误 -4 是什么意思?
一位客户报告连接失败,配置文件很奇怪:显然,自应用程序启动以来,只有通过 CFNetwork 的第一个 URL 请求才会失败。
CFNetwork 显然返回的错误代码是域 CFStreamErrorHTTP,但错误代码为 -4,它与该域的任何公开定义的错误代码都不对应。
在 CFHTTPStream.h 中,CFStreamErrorHTTP 公开定义的错误代码以 -3 结尾,强烈暗示 -4 可能是 Apple 正在使用但尚未公开记录的错误代码。
知道这是怎么回事吗?有其他人看到过这个错误代码并找到了它的规律或原因吗?
A customer is reporting a connection failure with a strange profile: it apparently only fails for the very first URL request via CFNetwork since the app has launched.
The error code apparently being returned by CFNetwork is domain CFStreamErrorHTTP, but with error code -4, which does not correspond to any publicly defined error code for this domain.
In CFHTTPStream.h, the publicly defined error codes for CFStreamErrorHTTP end auspiciously at -3, strongly hinting that -4 may be an error code that Apple is using but which has not yet been publicly documented.
Any idea what's going on here? Has anybody else seen this error code and found rhyme or reason for it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能不是最终答案,而且自从 CFNetwork 关闭源代码以来,这可能已经改变,但我确实在网上找到了以下内容,表明 -4 是连接丢失错误。
http://www.opensource.apple.com/source /CFNetwork/CFNetwork-129.9/HTTP/CFHTTPConnection.c
Probably not the final answer and this may have changed since they closed sourced CFNetwork, but I did find the following online which indicates that -4 is a connection lost error.
http://www.opensource.apple.com/source/CFNetwork/CFNetwork-129.9/HTTP/CFHTTPConnection.c
我想您必须展示一些失败的代码,但我想到了一些问题。首先,你能自己追踪这个问题,你能重现它吗?特别是,了解在哪个线程上发生这种情况以及当前的 runLoop 模式是什么会很有趣。它可能表示内部 CF 运行循环上的流或连接调度失败。
除此之外(很遗憾 CFNetwork 不再公开更新),它可能是无数的事情,但是如果您无法直接调试故障,您将需要记录尽可能多的信息(提示提示 - https://github.com/fpillet/NSLogger 可以帮助您远程记录客户端的信息)。
最后,在 Mac 开发论坛(如果您的代码在 iOS 上运行,则在 iOS 开发论坛)上提问。平·奎因,他什么都知道。一旦他无法公开回答问题,请打开 DTS 事件并向他发送票证#。他是你想要调查你的问题的人:-)
I guess you'll have to show some of the code that's failing, but a few questions spring to mind. First, can you trace this issue yourself, can you reproduce it? In particular, it would be interesting to see on which thread this happens, and what's the current runLoop mode. It could be indicative of a stream or connection that fails scheduling on the internal CF runloops.
Other than this (and it's a shame CFNetwork is no longer publicly updated), it could be a zillion things, but you'll need to log as much information as you can if you can't directly debug the failure (hint hint -- https://github.com/fpillet/NSLogger can help you remotely log the info from the client).
Finally, ask the question on Mac Dev Forums (or iOS Dev Forums if your code runs on iOS). Ping Quinn, He Knows It All. Once he can't publicly answer the question, open a DTS incident and send him the ticket #. He's the guy you want to look into your problem :-)