diff --git a/SDWebImage/Private/SDDisplayLink.m b/SDWebImage/Private/SDDisplayLink.m index 8ff0fc16..39371794 100644 --- a/SDWebImage/Private/SDDisplayLink.m +++ b/SDWebImage/Private/SDDisplayLink.m @@ -89,7 +89,12 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt #elif SD_IOS || SD_TV #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - NSTimeInterval duration = self.displayLink.duration * self.displayLink.frameInterval; + NSTimeInterval duration = 0; + if (@available(iOS 10.0, *)) { + duration = self.displayLink.targetTimestamp - CACurrentMediaTime(); + } else { + duration = self.displayLink.duration * self.displayLink.frameInterval; + } #pragma clang diagnostic pop #else NSTimeInterval duration = 0; @@ -98,7 +103,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt duration = nextFireDate - self.currentFireDate; } #endif - if (duration == 0) { + if (duration <= 0) { duration = kSDDisplayLinkInterval; } return duration;