react-native: IOS 17 Crash - UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={0, 0}

Description

React Native Version: 0.71.6

Issue:

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

Issue reproduce on IOS Device: IOS OS > 17

solution:

As per Apple UIGraphicsBeginImageContext() is decrypted

Steps to reproduce

  1. React native app on an ios emulator with OS version 17.2
  2. after some time, the app crashes

React Native Version

0.71.6

Affected Platforms

Runtime - iOS

Output of npx react-native info

OS: macOS 14.2.1
    CPU: (8) arm64 Apple M1
    Memory: 112.92 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.12.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.19.2 - /usr/local/bin/npm
    Watchman: 2023.12.04.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.14.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2
    Android SDK: Not Found
  IDEs:
    Android Studio: 2022.3 AI-223.8836.35.2231.10406996
    Xcode: 15.2/15C500b - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.21 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.6 => 0.71.6 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Stacktrace or Logs

Exception Type:  SIGABRT
Exception Codes: #0 at 0x1fb4d1fbc
Crashed Thread:  0

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

Reproducer

NA

Screenshots and Videos

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16

Most upvoted comments

in my case it happened when tintColor was passed in FastImage <FastImage tintColor={‘#000000’} style={styles.iconStyle1} source={require(‘…/…/assets/close.png’)} />

this fixed the issue <Image style={[styles.iconStyle1, { tintColor: ‘#000000’ }]} source={require(‘…/…/assets/close.png’)} />

Same issue IOS 17.0

Same here on 17.4.1

Screenshot 2024-04-24 at 16 06 58

same issue