在iOS17上,YYText会报以下错误:

(图片来源网络,侵删)
UIGraphicsBegiNimageContext() failed to allocate CGBitampContext: size={0, 0}, scale=3.000000, bitmAPInfo=0x2002. Use UIGraphicsImageRenderer to avoid this assert.
解决方法如下:

(图片来源网络,侵删)
在YYTextAsyncLayer.m文件中,_dISPlayAsync:(BOOL)async 方法中。
原代码:
UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, self.contentsScale); CGContextRef context = UIGraphicsGetCurrentContext(); if (self.opaque) { CGSize size = self.bounds.size; size.width *= self.contentsScale; size.height *= self.contentsScale; CGContextSAveGState(context); { if (!self.backgroundColor || CGColorGetAlpha(self.backgroundColor)修复后的代码:
UIGraphicsImageRendererFormat *format = [[UIGraphicsImageRendererFormat alloc] init]; format.opaque = self.opaque; format.scale = self.contentsScale; UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:self.bounds.size format:format]; UIImage *image = [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext) { CGContextRef context = rendererContext.CGContext; if (self.opaque) { CGSize size = self.bounds.size; size.width *= self.contentsScale; size.height *= self.contentsScale; CGContextSaveGState(context); { if (!self.backgroundColor || CGColorGetAlpha(self.backgroundColor)