美文网首页
HTTP请求 Code=28 "No space left on

HTTP请求 Code=28 "No space left on

作者: 生命不止运动不息 | 来源:发表于2022-04-19 21:38 被阅读0次

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

相关文章

网友评论

      本文标题:HTTP请求 Code=28 "No space left on

      本文链接:https://www.haomeiwen.com/subject/hzteertx.html