3

我正在尝试使用setDownloadProgressBlockAFHTTPRequestOperation 类。回调给了我 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 框架的问题吗?

4

1 回答 1

4

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

于 2012-03-04T00:00:03.323 回答