From e642024688952d6303c9e13ac2c5f60263ec5a00 Mon Sep 17 00:00:00 2001 From: Bogdan Poplauschi Date: Sun, 25 Sep 2016 20:07:12 +0300 Subject: [PATCH] Fix the build: UIButton and UIImageView are not defined on Mac OS or WatchOS --- SDWebImage/UIView+WebCache.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SDWebImage/UIView+WebCache.m b/SDWebImage/UIView+WebCache.m index f6d5a4aa..c941a41f 100644 --- a/SDWebImage/UIView+WebCache.m +++ b/SDWebImage/UIView+WebCache.m @@ -97,13 +97,17 @@ static char TAG_ACTIVITY_SHOW; - (void)sd_setImage:(UIImage *)image imageData:(NSData *)imageData basedOnClassOrViaCustomSetImageBlock:(SDSetImageBlock)setImageBlock { if (setImageBlock) { setImageBlock(image, imageData); - } else if ([self isKindOfClass:[UIImageView class]]) { + return; + } +#if SD_UIKIT + if ([self isKindOfClass:[UIImageView class]]) { UIImageView *imageView = (UIImageView *)self; imageView.image = image; } else if ([self isKindOfClass:[UIButton class]]) { UIButton *button = (UIButton *)self; [button setImage:image forState:UIControlStateNormal]; } +#endif } - (void)sd_setNeedsLayout {