We are also seeing crashes with UIGraphicsBeginImageContext on iOS 17 devices.
At first we also thought that it would happen because of a 0 in the width or height of the size. But it crashes in one app at this point:
if(size.width < 50 || size.height < 50)
{
return nil;
}
size = CGSizeMake(size.width*2.0f, size.height*2.0f);
UIGraphicsBeginImageContext(size);
With this code, it is impossible for the width or height to be 0. The crash must therefore also have other causes.
Unfortunately, we cannot reproduce the crash with our test devices.
Incident Identifier: AAAAAAAAAA-893D-4C7B-A933-AAAAAAAAAA
Hardware Model: iPad13,16
Process: AAAAAAAAAA [37228]
Path: /private/var/containers/Bundle/Application/AAAAAAAAAA-F8FB-405B-8DC7-AAAAAAAAAA/AAAAAAAAAA.app/AAAAAAAAAA
Identifier: AAAAAAAAAA.AAAAAAAAAA.AAAAAAAAAA
Version: 13.6 (1.0)
AppStoreTools: 15A240a
AppVariant: 1:iPad13,16:15
Code Type: ARM-64 (Native)
Role: Background
Parent Process: launchd [1]
Coalition: AAAAAAAAAA.AAAAAAAAAA.AAAAAAAAAA [700]
Date/Time: 2023-11-24 21:03:57.5000 -0500
Launch Time: 2023-11-24 08:47:34.0066 -0500
OS Version: iPhone OS 17.1.1 (21B91)
Release Type: User
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: SIGNAL 6 Abort trap: 6
Terminating Process: AAAAAAAAAA [37228]
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x18863c870 __exceptionPreprocess + 164 (NSException.m:249)
1 libobjc.A.dylib 0x1809a7c00 objc_exception_throw + 60 (objc-exception.mm:356)
2 Foundation 0x187ba6e54 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 172 (NSException.m:261)
3 UIKitCore 0x18a8683a4 _UIGraphicsBeginImageContextWithOptions + 568 (UIGraphics.m:407)
4 AAAAAAAAAA 0x100a9e83c -[AAAAAAAAAA getAaaaaImage:] + 88 (AAAAAAAAAA.m:7815)
5 AAAAAAAAAA 0x100a9e6b0 -[AAAAAAAAAA createAaaaa] + 92 (AAAAAAAAAA.m:7783)
6 AAAAAAAAAA 0x100a8b14c -[AAAAAAAAAA setAaaaaSize:] + 2664 (AAAAAAAAAA.m:2566)
7 AAAAAAAAAA 0x100a84164 -[AAAAAAAAAA viewDidLayoutSubviews] + 284 (AAAAAAAAAA.m:890)
8 UIKitCore 0x18a7a67f0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1876 (UIView.m:20001)
9 QuartzCore 0x189bbc1c0 CA::Layer::layout_if_needed(CA::Transaction*) + 500 (CALayer.mm:10804)
10 UIKitCore 0x18a7a9744 -[UIView(Hierarchy) layoutBelowIfNeeded] + 296 (UIView.m:14119)
11 UIKitCore 0x18a7ac3e8 -[UINavigationController _layoutViewController:] + 816 (UINavigationController.m:7728)
12 UIKitCore 0x18a7ac0b4 -[UINavigationController _layoutTopViewControllerLookForNested:] + 436 (UINavigationController.m:5626)
13 UIKitCore 0x18a9392a0 __105-[UINavigationController _repositionPaletteWithNavigationBarHidden:duration:shouldUpdateNavigationItems:]_block_invoke + 440 (UINavigationController.m:3149)