respuesta expectedContentLength retorno -1

Hola, necesito crear una vista de progreso cuando cargue datos de mi servicio web.

En realidad, el valor esperado deContentLength siempre regresa -1.

Después de ver muchos problemas similares, parece que mi servicio web nunca envía Content-Length :.

Entonces lo compruebo con CURL y aquí está el resultado:

< HTTP/1.1 200 OK
< Date: Thu, 21 Jun 2012 10:04:39 GMT
< Server: Apache/2.2.16 (Debian)
< X-Powered-By: PHP/5.3.3-7+squeeze9
< cache-control: no-cache
< Vary: Accept-Encoding
< Content-Type: text/html; charset=UTF-8
< Content-Length: 3239  
< Connection: Keep-Alive
< Set-Cookie: PHPSESSID=u4o4i9dofdgnkfmtnf163635j6; path=/

Y aquí está mi código para alcanzar la longitud.

long long expectDataSize;
long long currentDataSize;

....

 - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSHTTPURLResponse *)response
{
    NSLog(@"expect content length %lld", [response expectedContentLength]);
    expectDataSize = [response expectedContentLength];
    currentDataSize = 0;
}

¿Alguien ya ha visto este problema?

Respuestas a la pregunta(2)

Su respuesta a la pregunta