YYWebImage icon indicating copy to clipboard operation
YYWebImage copied to clipboard

使用NSURLSession代替NSURLConnection

Open yxztj opened this issue 10 years ago • 10 comments

在NSURLConnection.h里面提到 /*** DEPRECATED: The NSURLConnection class should no longer be used. NSURLSession is the replacement for NSURLConnection ***/ 是否考虑把YYWebImageOperation里的NSURLConnection替换为NSURLSession?

yxztj avatar Dec 24 '15 06:12 yxztj

目前还能用,而且还需要支持 iOS6,所以没打算换。 不过以后总会找机会换掉的。

ibireme avatar Dec 24 '15 06:12 ibireme

OK。或者也可以像AFNetworking那样分版本支持不同的iOS版本? 毕竟使用deprecated的类有一定风险。

yxztj avatar Dec 25 '15 01:12 yxztj

这种 API,只有大版本号更新的时候,才会有被完全抛弃的危险,在那之前有好几个月的测试版,来得及改。

ibireme avatar Dec 25 '15 02:12 ibireme

感谢作者,iOS10马上就出了,是否有考虑抛弃iOS6?目前90%以上的公司都面向iOS7+,并在明年直接考虑面向iOS8+,我也建议改为NSURLSession,希望作者能采纳!最后,对您的贡献表示感谢🙏

smithereensarr avatar Jun 30 '16 06:06 smithereensarr

SD也早些时候换成nsurlsession了

xxycode avatar Aug 11 '16 06:08 xxycode

现在都iOS8+了,iOS7也是时候抛弃了

Smeegol avatar Feb 21 '17 10:02 Smeegol

有 一个 PR 是做这个的 ,但是代码是有一些问题的,比如 LOCK 都没初始化,暂时不敢用

crespoxiao avatar Apr 20 '17 06:04 crespoxiao

作者有空希望替换为 NSURLSession 。

indulgeIn avatar Jul 20 '18 06:07 indulgeIn

今天读了YYWebImage,在源码里面好像没有看见处理相同url 重复下载的代码

muxueChen avatar Mar 16 '19 11:03 muxueChen

看了源码,里面还是用的是 NSURLConnection,现在这个网络这一块都是在用 NSURLSession 了

muxueChen avatar Mar 16 '19 11:03 muxueChen