之前 Beta 版 Xcode 12 RN 项目 iOS 本地图片不显示,Xcode 11 下则正常,以为是 Xcode bug没在意。没想到正式版更新后依然不显示,解决方案:
找到
- (void)displayLayer:(CALayer*)layer{
if (_currentFrame) {
layer.contentsScale = self.animatedImageScale;
layer.contents = (__bridge id)_currentFrame.CGImage;
}
}
替换为
- (void)displayLayer:(CALayer*)layer{
if (_currentFrame) {
layer.contentsScale= self.animatedImageScale;
layer.contents= (__bridgeid)_currentFrame.CGImage;
}else{
[superdisplayLayer:layer];
}
}