Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashing when running in Xcode15 beta 6 #637

Closed
mvn-khoavo-dn opened this issue Aug 17, 2023 · 7 comments
Closed

Crashing when running in Xcode15 beta 6 #637

mvn-khoavo-dn opened this issue Aug 17, 2023 · 7 comments

Comments

@mvn-khoavo-dn
Copy link

mvn-khoavo-dn commented Aug 17, 2023

Description

Crashing when running the app which is built by Xcode15 beta 6

Crash log

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={390, 0}, scale=3.000000, bitmapInfo=0x2002. Use UIGraphicsImageRenderer to avoid this assert.' libc++abi: terminating due to uncaught exception of type NSException *** Assertion failure in void _UIGraphicsBeginImageContextWithOptions(CGSize, BOOL, CGFloat, BOOL)(), UIGraphics.m:410

Steps to reproduce

Running the app which is built by Xcode15 beta 6 on iOS 17.0 beta device or Simulator iOS 17.0
The application will be crashed immediately after opening.

Snack, code example, screenshot, or link to a repository

Screenshot 2023-08-16 at 16 32 42 Screenshot 2023-08-16 at 16 46 05

Recommend Solution

I just tried to fix it by replacing UIGraphicsBeginImageContextWithOptions(self.bounds.size, !hasAlpha, 0.0); by [[UIGraphicsImageRenderer alloc] initWithSize: self.bounds.size]; in BVLinearGradientLayer.m file like this screenshot and the app can run normally.
Screenshot 2023-08-17 at 15 35 57

Another related issues from Apple's forum: Running in Xcode15beta crashed

Please check it and update the library as soon as possible. Thank you very much.

@suwu150
Copy link

suwu150 commented Sep 19, 2023

The gradient view created is not visible。 @mvn-khoavo-dn

I have also encountered the same problem. Has anyone solved it

@tomruijgrok
Copy link

This is a big problem. I am experiencing the same problem with IOS 17. The app is in production and I think if people update to IOS 17 it will crash immediately👀

@friederbluemle
Copy link
Member

I believe this issue has already been fixed by @Caiopia in #626 - The patch will be part of the upcoming 3.0.0 release (currently in alpha, beta coming soon). It has also been cherry-picked to the 2.8 series: https://github.com/react-native-linear-gradient/react-native-linear-gradient/releases/tag/v2.8.3

@tomruijgrok
Copy link

After upgrading to 2.8 it works again. I think this issue can be closed

@ucheNkadiCode
Copy link

I am still getting this error unfortunately. The problem could be because I am placing the linear gradient insdie of an animated view.

@ispyco
Copy link

ispyco commented Dec 13, 2023

xcode 15.0.1 have same problem in gradient text

@hoscahmet
Copy link

NOTE
the healthiest, if the project is small, update the react native version

WARNING
Since UIGraphicsBeginImageContext has been deprecated, it may also be caused by other libraries. For example; react-native-fast-image etc.
also used in older react-native versions

INFO
You can find where they are used by searching UIGraphicsBeginImageContext. Perform the search through xcode.

There is also a short video for the solution: https://www.youtube.com/watch?v=psIBtbwMLQE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants