HTTP请求 Code=28 "No space left on device"

1.问题:Http请求,返回208, 提示设备空间不足

image.png

2.原因:起初以为是硬盘空间没了,其实不是。实际上是URLSession太多了

参考Stack Overflow:

It appears to get called when there are too many NSURLSessions created, reaching a limit of (in our tests) 600-700 sessions, which are not maintained or closed properly. The error started to get thrown since iOS 14, so it is interesting to see if there was a limit introduced.

3.解决方法:

因为我的网络请求使用的是AFNetworking库,起初是一个请求创建一个 AFHTTPSessionManager的实例,请求多了,自然就会有多个URLSession。

所以改为使用单例,就没有此问题。
截屏2022-04-19 下午9.33.44.png
截屏2022-04-19 下午9.33.44.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。