diff --git a/SDWebImage/Core/SDImageCoderHelper.m b/SDWebImage/Core/SDImageCoderHelper.m index c29685a9..7bba1025 100644 --- a/SDWebImage/Core/SDImageCoderHelper.m +++ b/SDWebImage/Core/SDImageCoderHelper.m @@ -575,6 +575,10 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over if (image.sd_isAnimated) { return NO; } + // do not decode vector images + if (image.sd_isVector) { + return NO; + } return YES; } diff --git a/SDWebImage/Core/UIImage+Metadata.m b/SDWebImage/Core/UIImage+Metadata.m index ef63c41f..2d24c4e2 100644 --- a/SDWebImage/Core/UIImage+Metadata.m +++ b/SDWebImage/Core/UIImage+Metadata.m @@ -32,25 +32,31 @@ return (self.images != nil); } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - (BOOL)sd_isVector { if (@available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)) { - if (self.isSymbolImage) { + // Xcode 11 supports symbol image, keep Xcode 10 compatible currently + SEL SymbolSelector = NSSelectorFromString(@"isSymbolImage"); + if ([self respondsToSelector:SymbolSelector] && [self performSelector:SymbolSelector]) { + return YES; + } + // SVG + SEL SVGSelector = NSSelectorFromString(@"_CGSVGDocument"); + if ([self respondsToSelector:SVGSelector] && [self performSelector:SVGSelector]) { return YES; } } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - SEL SVGSelector = NSSelectorFromString(@"_CGSVGDocument"); - if ([self respondsToSelector:SVGSelector] && [self performSelector:SVGSelector] != nil) { - return YES; + if (@available(iOS 11.0, tvOS 11.0, watchOS 4.0, *)) { + // PDF + SEL PDFSelector = NSSelectorFromString(@"_CGPDFPage"); + if ([self respondsToSelector:PDFSelector] && [self performSelector:PDFSelector]) { + return YES; + } } - SEL PDFSelector = NSSelectorFromString(@"_CGPDFPage"); - if ([self respondsToSelector:PDFSelector] && [self performSelector:PDFSelector] != nil) { - return YES; - } -#pragma clang diagnostic pop return NO; } +#pragma clang diagnostic pop #else