From 25b4c178d945cb32dfcff5b07907e047d2d601e5 Mon Sep 17 00:00:00 2001 From: mythodeia Date: Wed, 15 Jul 2015 23:56:05 +0300 Subject: [PATCH] progress reports on main thread --- SDWebImage/SDWebImageDownloader.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SDWebImage/SDWebImageDownloader.m b/SDWebImage/SDWebImageDownloader.m index acda892c..e0f77d12 100644 --- a/SDWebImage/SDWebImageDownloader.m +++ b/SDWebImage/SDWebImageDownloader.m @@ -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) {