Skip to content

Commit

Permalink
Merge pull request SDWebImage#1218 from mythodeia/master
Browse files Browse the repository at this point in the history
progress callbacks now report on main thread
  • Loading branch information
bpoplauschi committed Jul 15, 2015
2 parents be560a4 + 25b4c17 commit a45c722
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 a45c722

Please sign in to comment.