Merge pull request #1218 from mythodeia/master

progress callbacks now report on main thread
This commit is contained in:
Bogdan Poplauschi 2015-07-16 00:11:12 +03:00
commit a45c722fc8
1 changed files with 4 additions and 2 deletions

View File

@ -142,8 +142,10 @@ static NSString *const kCompletedCallbackKey = @"completed";
callbacksForURL = [sself.URLCallbacks[url] copy];
});
for (NSDictionary *callbacks in callbacksForURL) {
SDWebImageDownloaderProgressBlock callback = callbacks[kProgressCallbackKey];
if (callback) callback(receivedSize, expectedSize);
dispatch_async(dispatch_get_main_queue(), ^{
SDWebImageDownloaderProgressBlock callback = callbacks[kProgressCallbackKey];
if (callback) callback(receivedSize, expectedSize);
});
}
}
completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished) {