iOS SDWebImage expectedsize =0
来源:互联网 发布:js 720度全景 编辑:程序博客网 时间:2024/06/09 15:34
今天在使用SDWebimage下载图片时需要获取下载的进度
使用[SDWebImageManagersharedManager]
- (id <SDWebImageOperation>)downloadImageWithURL:(NSURL *)urloptions:(SDWebImageOptions)options
progress:(SDWebImageDownloaderProgressBlock)progressBlock
completed:(SDWebImageCompletionWithFinishedBlock)completedBlock
发现progressBlock参数中的expectedsize一直为0.
经过google、百度各种搜索,终于解决了这个问题。
这个因为NSHTTPURLResponse中
Accept-Encoding为gzip造成的
当遇到Accept-Encoding为gzip时,expectedsize会变为-1不确定的大小
此时在sdwebimage中expectedsize判断小于0,就会赋值为0
所以如果确定文件的大小时,可以将Accept-Encoding修改成非gzip的就可以获取需要的文件大小了
0 0
- iOS SDWebImage expectedsize =0
- iOS:SDWebImage
- iOS SDWebImage
- iOS SDWebImage
- IOS之SDWebImage
- 【iOS开发】---- 开源库SDWebImage
- ios 开发随记 SDWebImage
- iOS:SDWebImage使用详解
- IOS SDWebImage的使用
- IOS初级:SDWebImage
- iOS开发之SDWebImage
- iOS---SDWebImage的使用
- IOS- SDWebImage的作用
- iOS SDWebImage 淡入 UITableViewCell
- iOS SDwebimage清除缓存
- ios SDWebImage 原理
- ios-SDWebImage知识点
- iOS SDWebImage基本使用
- vmstat 中swpd的意义
- C\C++和Java 的区别(特别是在内存分配方面)
- 《鸟哥的Linux私房菜》第七章 Linux文件与目录管理
- 如何优雅的包装java写的桌面应用程序给客户
- c# 强制杀掉进程
- iOS SDWebImage expectedsize =0
- Implement strStr()
- OC宏定义实现单例设计模式
- 如何快速学习C语言
- Android精确适配不同的dpi和屏幕尺寸(附dimens按比例变化数字的工具类)
- Find error messages with a Correlation ID token in SharePoint 2010
- 仿网易客户端实现顶部导航效果(ViewPager+Fragment)
- 如何利用老毛桃安装window系统
- android 保存bitmap到指定文件