Problem
I upgraded a React Native mobile app to iOS 17 and encountered an app crash when uploading images:
Terminating app due to uncaught exception 'NSInternalInconsistencyException'
UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={0, 0}, scale=3.000000, bitmapInfo=0x2002. Use UIGraphicsImageRenderer to avoid this assert.
UIGraphicsBeginImageContext()
is a deprecated function in iOS 17 and when the width or height is 0, it throws an exception.
I did a recursive search for UIGraphicsBeginImageContext
in my working directory:
grep -r UIGraphicsBeginImageContext
And found it’s used by FullStory:
Binary file ./ios/Pods/FullStory/FullStory.xcframework/ios-arm64_x86_64-simulator/FullStory.framework/FullStory matches
Binary file ./ios/Pods/FullStory/FullStory.xcframework/ios-arm64/FullStory.framework/FullStory matches
Solution
I reached out to FullStory support and they helped guide me to upgrade the iOS SDK to the latest version following their release notes.
I updated ios/Podfile
:
- pod 'FullStory', :http => 'https://ios-releases.fullstory.com/fullstory-1.42.0-xcframework.tar.gz'
+ pod 'FullStory', :http => 'https://ios-releases.fullstory.com/fullstory-1.48.0-xcframework.tar.gz'
Then ran pod install
so ios/Podfile.lock
is updated:
bundle exec pod install --project-directory=ios # cd ios; pod install; cd -
I also updated android/build.gradle
to be consistent:
- classpath 'com.fullstory:gradle-plugin-local:1.42.0'
+ classpath 'com.fullstory:gradle-plugin-local:1.48.0'
After restarting the React Native app, the error no longer showed up.