首页 - IOS编程

UIGraphicsBeginImageContextWithOptions 方法崩溃(Crash)

Assertion failure in void _UIGraphicsBeginImageContextWithOptions(CGSize, BOOL, CGFloat, BOOL)(), 

如果出现上述错误,是因为在iOS 17之后 UIGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale) 中的 CGSize 宽和高有一个为0 就会crash。因此必须保证传入参数size必须有值