From e132300a0f569b0120aa6d858152901fa13d29ad Mon Sep 17 00:00:00 2001 From: Jimmie Jensen Date: Mon, 13 Feb 2017 16:21:47 +0100 Subject: [PATCH 1/2] #1801: Makes sure UIActivityIndicator view is always initialized on the main thread --- SDWebImage/UIImageView+WebCache.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SDWebImage/UIImageView+WebCache.m b/SDWebImage/UIImageView+WebCache.m index 889305b2..06f29f53 100644 --- a/SDWebImage/UIImageView+WebCache.m +++ b/SDWebImage/UIImageView+WebCache.m @@ -173,10 +173,10 @@ static char TAG_ACTIVITY_SHOW; - (void)addActivityIndicator { if (!self.activityIndicator) { - self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:[self getIndicatorStyle]]; - self.activityIndicator.translatesAutoresizingMaskIntoConstraints = NO; - dispatch_main_async_safe(^{ + self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:[self getIndicatorStyle]]; + self.activityIndicator.translatesAutoresizingMaskIntoConstraints = NO; + [self addSubview:self.activityIndicator]; [self addConstraint:[NSLayoutConstraint constraintWithItem:self.activityIndicator From 25e19a2c75c4a4d16fc96be0358b6a2e94dd57ac Mon Sep 17 00:00:00 2001 From: Jimmie Jensen Date: Mon, 13 Feb 2017 16:34:27 +0100 Subject: [PATCH 2/2] #1801: Makes sure UIActivityIndicator view is always initialized on the main thread --- SDWebImage/UIView+WebCache.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SDWebImage/UIView+WebCache.m b/SDWebImage/UIView+WebCache.m index ad2b54c4..1f1504f7 100644 --- a/SDWebImage/UIView+WebCache.m +++ b/SDWebImage/UIView+WebCache.m @@ -157,10 +157,10 @@ static char TAG_ACTIVITY_SHOW; - (void)sd_addActivityIndicator { #if SD_UIKIT if (!self.activityIndicator) { - self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:[self sd_getIndicatorStyle]]; - self.activityIndicator.translatesAutoresizingMaskIntoConstraints = NO; - dispatch_main_async_safe(^{ + self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:[self sd_getIndicatorStyle]]; + self.activityIndicator.translatesAutoresizingMaskIntoConstraints = NO; + [self addSubview:self.activityIndicator]; [self addConstraint:[NSLayoutConstraint constraintWithItem:self.activityIndicator