AFNetworking进展 [英] AFNetworking progress

查看:99
本文介绍了AFNetworking进展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用AFHTTPRequestOperation类的 setDownloadProgressBlock 。回调给我3个参数:

I am trying to use setDownloadProgressBlock of AFHTTPRequestOperation class. The call back gives me 3 parameters:

( NSInteger bytesRead , NSInteger totalBytesRead , NSInteger totalBytesExpectedToRead ) 

为了让我获得进度,我需要totalBytesExpectedToRead值,但它给我一个-1。我检查了HTTP响应的头部,内容长度是有...

In order for me to get the progress, I need the totalBytesExpectedToRead value, but it's giving me a -1. I checked the headers of the HTTP response and the content length is there...

{
    "Cache-Control" = "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";
    Connection = "Keep-Alive";
    "Content-Encoding" = gzip;
    "Content-Length" = 36902;
    "Content-Type" = "text/plain";
    Date = "Sat, 03 Mar 2012 23:53:11 GMT";
    Expires = "Thu, 19 Nov 1981 08:52:00 GMT";
    "Keep-Alive" = "timeout=5, max=95";
    "Last-Modified" = "Sat, 03 Mar 2012 23:53:11 GMT";
    Pragma = "no-cache";
    Server = "Apache/2.2.20 (Ubuntu)";
    Vary = "Accept-Encoding";
    "X-Powered-By" = "PHP/5.3.6-13ubuntu3.3";
}

这是AFNetworking框架的问题吗?

Is this a problem with the AFNetworking framework?

推荐答案

请检查以下响应,它是与gzip格式的内容相关的NSURLConnection的限制:http://stackoverflow.com/a/7426735/250164

Please check the following response, it's a limitation of NSURLConnection related to the content being in gzip format: http://stackoverflow.com/a/7426735/250164

这篇关于AFNetworking进展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆