AFNetworking进展

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

 ( NSInteger bytesRead , NSInteger totalBytesRead , NSInteger totalBytesExpectedToRead ) 

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

 { "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框架的问题吗?

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