Revert the change for APNG constants fix for iOS 8 devices which cause crash, use previous deployment target macro check instead of runtime firmware version check

This commit is contained in:
DreamPiggy 2019-10-09 16:09:59 +08:00
parent 4ad718a1ed
commit 456bfbac52
1 changed files with 9 additions and 14 deletions

View File

@ -14,20 +14,15 @@
#endif #endif
// iOS 8 Image/IO framework binary does not contains these APNG contants, so we define them. Thanks Apple :) // iOS 8 Image/IO framework binary does not contains these APNG contants, so we define them. Thanks Apple :)
static NSString * kSDCGImagePropertyAPNGLoopCount = @"LoopCount"; // We can not use runtime @available check for this issue, because it's a global symbol and should be loaded during launch time by dyld. So hack if the min deployment target version < iOS 9.0, whatever it running on iOS 9+ or not.
static NSString * kSDCGImagePropertyAPNGDelayTime = @"DelayTime"; #if (__IPHONE_OS_VERSION_MIN_REQUIRED && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)
static NSString * kSDCGImagePropertyAPNGUnclampedDelayTime = @"UnclampedDelayTime"; const CFStringRef kCGImagePropertyAPNGLoopCount = (__bridge CFStringRef)@"LoopCount";
const CFStringRef kCGImagePropertyAPNGDelayTime = (__bridge CFStringRef)@"DelayTime";
const CFStringRef kCGImagePropertyAPNGUnclampedDelayTime = (__bridge CFStringRef)@"UnclampedDelayTime";
#endif
@implementation SDImageAPNGCoder @implementation SDImageAPNGCoder
+ (void)initialize {
if (@available(iOS 9, *)) {
kSDCGImagePropertyAPNGLoopCount = (__bridge NSString *)kCGImagePropertyAPNGLoopCount;
kSDCGImagePropertyAPNGDelayTime = (__bridge NSString *)kCGImagePropertyAPNGDelayTime;
kSDCGImagePropertyAPNGUnclampedDelayTime = (__bridge NSString *)kCGImagePropertyAPNGUnclampedDelayTime;
}
}
+ (instancetype)sharedCoder { + (instancetype)sharedCoder {
static SDImageAPNGCoder *coder; static SDImageAPNGCoder *coder;
static dispatch_once_t onceToken; static dispatch_once_t onceToken;
@ -52,15 +47,15 @@ static NSString * kSDCGImagePropertyAPNGUnclampedDelayTime = @"UnclampedDelayTim
} }
+ (NSString *)unclampedDelayTimeProperty { + (NSString *)unclampedDelayTimeProperty {
return kSDCGImagePropertyAPNGUnclampedDelayTime; return (__bridge NSString *)kCGImagePropertyAPNGUnclampedDelayTime;
} }
+ (NSString *)delayTimeProperty { + (NSString *)delayTimeProperty {
return kSDCGImagePropertyAPNGDelayTime; return (__bridge NSString *)kCGImagePropertyAPNGDelayTime;
} }
+ (NSString *)loopCountProperty { + (NSString *)loopCountProperty {
return kSDCGImagePropertyAPNGLoopCount; return (__bridge NSString *)kCGImagePropertyAPNGLoopCount;
} }
+ (NSUInteger)defaultLoopCount { + (NSUInteger)defaultLoopCount {