From 59e220cc68a334178924a9efba0ab4dd9e32fe94 Mon Sep 17 00:00:00 2001 From: yushengyang <784351329@qq.com> Date: Tue, 28 Nov 2017 15:19:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87URL=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E6=97=B6=E8=AF=B7=E6=B1=82=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 图片URL为空字符串时请求异常 --- YYKit/Image/Categories/CALayer+YYWebImage.m | 2 +- YYKit/Image/Categories/MKAnnotationView+YYWebImage.m | 2 +- YYKit/Image/Categories/UIButton+YYWebImage.m | 4 ++-- YYKit/Image/Categories/UIImageView+YYWebImage.m | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/YYKit/Image/Categories/CALayer+YYWebImage.m b/YYKit/Image/Categories/CALayer+YYWebImage.m index 584bc4b9..efac6a2c 100644 --- a/YYKit/Image/Categories/CALayer+YYWebImage.m +++ b/YYKit/Image/Categories/CALayer+YYWebImage.m @@ -110,7 +110,7 @@ - (void)setImageWithURL:(NSURL *)imageURL [self removeAnimationForKey:_YYWebImageFadeAnimationKey]; } - if (!imageURL) { + if (!imageURL || imageURL.absoluteString.length == 0) { if (!(options & YYWebImageOptionIgnorePlaceHolder)) { self.contents = (id)placeholder.CGImage; } diff --git a/YYKit/Image/Categories/MKAnnotationView+YYWebImage.m b/YYKit/Image/Categories/MKAnnotationView+YYWebImage.m index ff2276ff..c2fe3990 100644 --- a/YYKit/Image/Categories/MKAnnotationView+YYWebImage.m +++ b/YYKit/Image/Categories/MKAnnotationView+YYWebImage.m @@ -109,7 +109,7 @@ - (void)setImageWithURL:(NSURL *)imageURL [self.layer removeAnimationForKey:_YYWebImageFadeAnimationKey]; } } - if (!imageURL) { + if (!imageURL || imageURL.absoluteString.length == 0) { if (!(options & YYWebImageOptionIgnorePlaceHolder)) { self.image = placeholder; } diff --git a/YYKit/Image/Categories/UIButton+YYWebImage.m b/YYKit/Image/Categories/UIButton+YYWebImage.m index 56089d15..ac2e46fa 100644 --- a/YYKit/Image/Categories/UIButton+YYWebImage.m +++ b/YYKit/Image/Categories/UIButton+YYWebImage.m @@ -96,7 +96,7 @@ - (void)_setImageWithURL:(NSURL *)imageURL int32_t sentinel = [setter cancelWithNewURL:imageURL]; dispatch_async_on_main_queue(^{ - if (!imageURL) { + if (!imageURL || imageURL.absoluteString.length == 0) { if (!(options & YYWebImageOptionIgnorePlaceHolder)) { [self setImage:placeholder forState:state.integerValue]; } @@ -273,7 +273,7 @@ - (void)_setBackgroundImageWithURL:(NSURL *)imageURL int32_t sentinel = [setter cancelWithNewURL:imageURL]; dispatch_async_on_main_queue(^{ - if (!imageURL) { + if (!imageURL || imageURL.absoluteString.length == 0) { if (!(options & YYWebImageOptionIgnorePlaceHolder)) { [self setBackgroundImage:placeholder forState:state.integerValue]; } diff --git a/YYKit/Image/Categories/UIImageView+YYWebImage.m b/YYKit/Image/Categories/UIImageView+YYWebImage.m index 18bb1310..bfefaf9d 100644 --- a/YYKit/Image/Categories/UIImageView+YYWebImage.m +++ b/YYKit/Image/Categories/UIImageView+YYWebImage.m @@ -117,7 +117,7 @@ - (void)setImageWithURL:(NSURL *)imageURL } } - if (!imageURL) { + if (!imageURL || imageURL.absoluteString.length == 0) { if (!(options & YYWebImageOptionIgnorePlaceHolder)) { self.image = placeholder; } @@ -281,7 +281,7 @@ - (void)setHighlightedImageWithURL:(NSURL *)imageURL [self.layer removeAnimationForKey:_YYWebImageFadeAnimationKey]; } } - if (!imageURL) { + if (!imageURL || imageURL.absoluteString.length == 0) { if (!(options & YYWebImageOptionIgnorePlaceHolder)) { self.highlightedImage = placeholder; }