1.問題:Http請求蹋艺,返回208, 提示設(shè)備空間不足
image.png
2.原因:起初以為是硬盤空間沒了,其實(shí)不是。實(shí)際上是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.解決方法:
因?yàn)槲业木W(wǎng)絡(luò)請求使用的是AFNetworking庫,起初是一個(gè)請求創(chuàng)建一個(gè) AFHTTPSessionManager的實(shí)例,請求多了檀训,自然就會(huì)有多個(gè)URLSession。
![截屏2022-04-19 下午9.33.44.png](https://upload-images.jianshu.io/upload_images/14458179-2139bf17846fa54d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
截屏2022-04-19 下午9.33.44.png