...
|
...
|
@@ -125,7 +125,7 @@ NSString *const SDWebImageDownloadFinishNotification = @"SDWebImageDownloadFinis |
|
|
}
|
|
|
else {
|
|
|
if (self.completedBlock) {
|
|
|
self.completedBlock(nil, nil, [NSError errorWithDomain:NSURLErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Connection can't be initialized"}], YES);
|
|
|
self.completedBlock(nil, nil, nil, [NSError errorWithDomain:NSURLErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Connection can't be initialized"}], YES);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -264,7 +264,7 @@ NSString *const SDWebImageDownloadFinishNotification = @"SDWebImageDownloadFinis |
|
|
});
|
|
|
|
|
|
if (self.completedBlock) {
|
|
|
self.completedBlock(nil, nil, [NSError errorWithDomain:NSURLErrorDomain code:[((NSHTTPURLResponse *)response) statusCode] userInfo:nil], YES);
|
|
|
self.completedBlock(nil, nil, nil, [NSError errorWithDomain:NSURLErrorDomain code:[((NSHTTPURLResponse *)response) statusCode] userInfo:nil], YES);
|
|
|
}
|
|
|
CFRunLoopStop(CFRunLoopGetCurrent());
|
|
|
[self done];
|
...
|
...
|
@@ -342,7 +342,7 @@ NSString *const SDWebImageDownloadFinishNotification = @"SDWebImageDownloadFinis |
|
|
CGImageRelease(partialImageRef);
|
|
|
dispatch_main_sync_safe(^{
|
|
|
if (self.completedBlock) {
|
|
|
self.completedBlock(image, nil, nil, NO);
|
|
|
self.completedBlock(nil, image, nil, nil, NO);
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -401,7 +401,7 @@ NSString *const SDWebImageDownloadFinishNotification = @"SDWebImageDownloadFinis |
|
|
|
|
|
if (completionBlock) {
|
|
|
if (self.options & SDWebImageDownloaderIgnoreCachedResponse && responseFromCached) {
|
|
|
completionBlock(nil, nil, nil, YES);
|
|
|
completionBlock(nil, nil, nil, nil, YES);
|
|
|
} else if (self.imageData) {
|
|
|
UIImage *image = [UIImage sd_imageWithData:self.imageData];
|
|
|
NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:self.request.URL];
|
...
|
...
|
@@ -414,13 +414,13 @@ NSString *const SDWebImageDownloadFinishNotification = @"SDWebImageDownloadFinis |
|
|
}
|
|
|
}
|
|
|
if (CGSizeEqualToSize(image.size, CGSizeZero)) {
|
|
|
completionBlock(nil, nil, [NSError errorWithDomain:SDWebImageErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Downloaded image has 0 pixels"}], YES);
|
|
|
completionBlock(nil, nil, nil, [NSError errorWithDomain:SDWebImageErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Downloaded image has 0 pixels"}], YES);
|
|
|
}
|
|
|
else {
|
|
|
completionBlock(image, self.imageData, nil, YES);
|
|
|
completionBlock(self.request, image, self.imageData, nil, YES);
|
|
|
}
|
|
|
} else {
|
|
|
completionBlock(nil, nil, [NSError errorWithDomain:SDWebImageErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Image data is nil"}], YES);
|
|
|
completionBlock(nil, nil, nil, [NSError errorWithDomain:SDWebImageErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Image data is nil"}], YES);
|
|
|
}
|
|
|
}
|
|
|
self.completionBlock = nil;
|
...
|
...
|
@@ -439,7 +439,7 @@ NSString *const SDWebImageDownloadFinishNotification = @"SDWebImageDownloadFinis |
|
|
}
|
|
|
|
|
|
if (self.completedBlock) {
|
|
|
self.completedBlock(nil, nil, error, YES);
|
|
|
self.completedBlock(nil, nil, nil, error, YES);
|
|
|
}
|
|
|
self.completionBlock = nil;
|
|
|
[self done];
|
...
|
...
|
|