문제

I'm using ASIHTTP in my iOS app to download a queue of images. The problem is that under bad 3g connections sometimes the image download will fail and you will get a partially downloaded image (with the rest of the image being gray).

Now the question:

I'm getting from my webserver in the HTTP Headers the content-length value. Is this value going to be the correct size of the whole image, so I can verify against this the downloaded image, or if the connection is interrupted the content-lenght will only include the bytes that where downloaded at that moment, meaning I can't verify this way if the image was downloaded complete?

도움이 되었습니까?

해결책

You might want to look at the answers posted for this question, usually it is indeed correct, otherwise it serves little purpose, however I'm not sure if it's as easy as comparing the two numbers after the download has finished, but it's probably reliable 99% of the time.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top