Skip to content

Commit

Permalink
progress reports on main thread
Browse files Browse the repository at this point in the history
  • Loading branch information
mythodeia committed Jul 15, 2015
1 parent df751e7 commit 25b4c17
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions SDWebImage/SDWebImageDownloader.m
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,10 @@ - (void)setOperationClass:(Class)operationClass {
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) {
Expand Down

0 comments on commit 25b4c17

Please sign in to comment.