-
Notifications
You must be signed in to change notification settings - Fork 98
Image incomplete download #90
Comments
Hi! My theory is that it happens when NSURLSessionTask fails with some error, but already has some loaded data. I haven't worked with this code for a while, but it seems that the reason for this is here in DFImageManagerLoader class: - (void)_loadOperation:(nonnull _DFImageLoadOperation *)operation didCompleteWithData:(nullable NSData *)data info:(nullable NSDictionary *)info error:(nullable NSError *)error {
if (data.length) {
typeof(self) __weak weakSelf = self;
[_decodingQueue addOperationWithBlock:^{
UIImage *image = [weakSelf.conf.decoder imageWithData:data partial:NO];
[weakSelf _loadOperation:operation didCompleteWithImage:image info:info error:error];
}];
} else {
[self _loadOperation:operation didCompleteWithImage:nil info:info error:error];
}
} We've experienced this kind of behaviour a while ago, but we haven't paid that much attention to it. It might be a good time to actually fix this. Thanks for the report. |
This should not be happening when you use AFNetworking subspec, because AFURLSessionManager prevents completion handler from being called with response data when error occurred. |
I fixed that by changing the method _loadOperation as you pointed out below
Thank you a lot |
A pull request would be nice 👍 |
Firstly, thank you for this nice library.
I have a problem with only some specifics URLs :
When I have a bad network conditions, I get incomplete download, and the image is not stored in cache :
The header of the URL of the image :
Cache-Control → private
Connection → keep-alive
Content-Length → 94896
Content-Type → image/jpg
Date → Tue, 12 Jan 2016 14:21:14 GMT
Expires → Thu, 11-Feb-2016 14:21:13 GMT
Pragma → cache
Server → Rocket 1.2.6 Python/2.7.3
X-Powered-By → web2py
Example of URL : http://preprod.verybuzzy.com:8000/bitc/Webservice_Media/getUserPhoto/1/58/1
Have you any idea what it is this bug?
Thank you
The text was updated successfully, but these errors were encountered: