Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDAnimatedImageView doesn't render in iOS 14 Beta 1 #3040

Closed
3 tasks done
cyanzhong opened this issue Jun 23, 2020 · 5 comments
Closed
3 tasks done

SDAnimatedImageView doesn't render in iOS 14 Beta 1 #3040

cyanzhong opened this issue Jun 23, 2020 · 5 comments
Labels
apple bug apple's bug cause our framework author's pain bug

Comments

@cyanzhong
Copy link

cyanzhong commented Jun 23, 2020

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.

@dreampiggy dreampiggy added the bug label Jun 23, 2020
@dreampiggy
Copy link
Contributor

dreampiggy commented Jun 23, 2020

@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.

@dreampiggy dreampiggy added the apple bug apple's bug cause our framework author's pain label Jun 23, 2020
@dreampiggy
Copy link
Contributor

dreampiggy commented Jun 23, 2020

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

@lvyuqiang
Copy link

We also meet it , waiting for apple fix it

@dreampiggy
Copy link
Contributor

dreampiggy commented Jun 23, 2020

@cyanzhong @lvyuqiang
Release v5.8.2 Patch version

@y500
Copy link

y500 commented Sep 29, 2020

mark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apple bug apple's bug cause our framework author's pain bug
Projects
None yet
Development

No branches or pull requests

4 participants