diff --git a/SDWebImage/Core/UIImage+Metadata.m b/SDWebImage/Core/UIImage+Metadata.m index 8a8e07ea..c6d5ed85 100644 --- a/SDWebImage/Core/UIImage+Metadata.m +++ b/SDWebImage/Core/UIImage+Metadata.m @@ -143,6 +143,7 @@ - (BOOL)sd_isVector { NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); + // This may returns a NSProxy, so don't use `class` to check NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; if ([imageRep isKindOfClass:[NSPDFImageRep class]]) { return YES; @@ -150,7 +151,8 @@ if ([imageRep isKindOfClass:[NSEPSImageRep class]]) { return YES; } - if ([NSStringFromClass(imageRep.class) hasSuffix:@"NSSVGImageRep"]) { + Class NSSVGImageRepClass = NSClassFromString([NSString stringWithFormat:@"_%@", SD_NSSTRING(NSSVGImageRep)]); + if ([imageRep isKindOfClass:NSSVGImageRepClass]) { return YES; } return NO;