本文介绍: 在iOS17.0 版本中,如果UIGraphicsBeginImageContextWit函数size参数传入的是(0,0),则会导致程序崩溃报错内容如下:Thread 1: “UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={0, 0},

版本iOS17,运行会报UIGraphicsBeginImageContextWithOptions函数崩溃

在iOS17.0 版本中,如果此函数size参数传入的是(0,0),则会导致程序崩溃报错内容如下:

Thread 1: “UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={0, 0}, scale=3.000000, bitmapInfo=0x2002. Use UIGraphicsImageRenderer to avoid this assert.”

解决办法

1、检查传入的size参数是否为(0,0),尤其是使用Masonry函数视图进行布局

2、修改传入的size参数问题解决

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注