Sdwebimage: SDAnimatedImageView doesn't render in iOS 14 Beta 1

Created on 23 Jun 2020  路  5Comments  路  Source: SDWebImage/SDWebImage

New Issue Checklist

Issue Info

Info | Value |
-------------------------|-------------------------------------|
Platform Name | iOS
Platform Version | 14.0
SDWebImage Version | 5.8.1
Integration Method | CocoaPods
Xcode Version | 12.0 beta (12A6159)
Repro rate | 100%

Issue Description and Steps

This doesn't render anything:

SDAnimatedImageView *imageView = [SDAnimatedImageView new];
imageView.image = [UIImage systemImageNamed:@"trash"];
imageView.backgroundColor = [UIColor redColor];
imageView.frame = CGRectMake(100, 100, 100, 100);
[self.view addSubview:imageView];

UIImageView works fine:

UIImageView *imageView = [UIImageView new];
imageView.image = [UIImage systemImageNamed:@"trash"];
imageView.backgroundColor = [UIColor redColor];
imageView.frame = CGRectMake(100, 100, 100, 100);
[self.view addSubview:imageView];

Building the repro code with Xcode 11 works fine as well.

The root cause might be currentFrame is nil, and displayLayer: doesn't do anything.

apple bug bug

Most helpful comment

Seems some break change to that displayLayer: delegate method.

on iOS 13: If we override this, UIKit will render the UIImageView.image itself before calling this method. So even if self.currentFrame == nil, the UIImageView.image get rendered.
on iOS 14: UIKit no longer render anything if you override that displayLayer: method. We can have a backup to render layer.contents for this case by ourself.

Temp workaround:

image

All 5 comments

@cyanzhong This effect only some custom codec like Static WebP. For SDAnimatedImageIOCoder like GIF/APNG, it does not get effected. Animated WebP works as well.

This is not related to that currentFrame is nil. The SDAnimatedImageView.image != nil, however, UIKit does not render the CGImage. (However, why does Xcode View Debug show that Image as normal ? 馃槙 )

image

Seems some hack from Apple UIKit team that break the UIImage subclass to work. Invesiting. I guess maybe something about CGImageCreate or color profile.

Seems some break change to that displayLayer: delegate method.

on iOS 13: If we override this, UIKit will render the UIImageView.image itself before calling this method. So even if self.currentFrame == nil, the UIImageView.image get rendered.
on iOS 14: UIKit no longer render anything if you override that displayLayer: method. We can have a backup to render layer.contents for this case by ourself.

Temp workaround:

image

We also meet it , waiting for apple fix it

@cyanzhong @lvyuqiang
Release v5.8.2 Patch version

mark

Was this page helpful?
0 / 5 - 0 ratings