Crash When Run app On Xcode15 Simulator

When UICollectionViewFlowLayoutAlertForInvalidItemSize Occured Some Log Like These Occurred, and then app crash

*** Assertion failure in void _UIGraphicsBeginImageContextWithOptions(CGSize, BOOL, CGFloat, BOOL)(), UIGraphics.m:410

crash Output

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={0, 16}, scale=3.000000, bitmapInfo=0x2002. Use UIGraphicsImageRenderer to avoid this assert.'

I have the same issue, but on a real device. Not using the simulator. Did you find a solution?

I'm seeing it on both device and simulator. Somehow it sometimes doesn't happen on a sim.

This is still an issue with Xcode 15 beta 5/iOS 17 beta 4

The crash is caused by calling UIGraphicsBeginImageContextWithOptions() with a size where either the width or height is 0. e.g. (0,0). The tricky part is that it somehow crashes completely and doesn't give you a full stack trace so you can track down the source of the problem.

I have the same issue, but on a real device. Not using the simulator. Did you find a solution?

In our case, we found the issue was caused by a resizable image in a UIImageView that was set to tile mode for resizing the center. Luckily for the image being used we could switch to stretch and get the same result, and the exception has gone away. Your results may vary.

Did you guys found any fix for this??

any updates on this issue?? it would be very helpful

Exception thrown while executing UI block: UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={0, 0}, scale=3.000000, bitmapInfo=0x2002. Use UIGraphicsImageRenderer to avoid this assert.

__44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke RCTUIManager.m:1202 __44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke.206 __RCTExecuteOnMainQueue_block_invoke

this is the error In React native

I have the same issue now, does anyone have any solution?

Same issue. No solutions?

Same error here, Exception thrown while executing UI block: UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={0, 0}, scale=3.000000, bitmapInfo=0x2002. Use UIGraphicsImageRenderer to avoid this assert.

any solutions?

Solution is make sure the size is not zero. In my case, I changed the view init from MyView() to MyView(frame: self.view.bounds), and then the crash is gone.

UIGraphicsBeginImageContextWithOptions is deprecated use UIGraphicsImageRenderer, this occurs on ios >= 17 both simulator and phones

I have the same exact issue in react-native app. Is there a solution for this? Using xCode v15 and trying to run the app on iPhone 15 simulator

Here is an SO, can probably help migrate to the new UIGraphicsImageRenderer usage. https://stackoverflow.com/a/40867644/1154836

Crash When Run app On Xcode15 Simulator
 
 
Q