EXC_BAD_ACCESS when creating a CIContext on iOS8.1 but not 9 or 10

I get exc_bad_access in the line CIContext *context = [CIContext contextWithOptions:nil];

I turned on the zombies and checked with the tools: No luck.

Full code:

 - (UIImage *) doBinarize:(UIImage *)sourceImage withThreshold:(float)threshold { UIImage *newImage; if (sourceImage){ CIContext *context = [CIContext contextWithOptions:nil]; CIImage *image = [[CIImage alloc] initWithImage:sourceImage]; CIImage *cImg = [self AdaptiveThresholdFilter:image withThreshold:threshold]; CIImage *ciImage = cImg; CGImageRef cgImage = [context createCGImage:ciImage fromRect:CGRectMake(0, 0, sourceImage.size.width, sourceImage.size.height)]; newImage = [UIImage imageWithCGImage:cgImage]; CGImageRelease(cgImage); } else { return nil; } return newImage; } 

However, I am almost everywhere where I put the CIContext contextWithOptions line, the application will crash there.

This is on iOS8.1, iPhone 5C. It should be noted that on iOS9 or iOS10 there are no problems.

Any suggestions?

+7
ios ios8 core-image exc-bad-access
source share

No one has answered this question yet.

See related questions:

1665
How can I make UITextField move up when there is a keyboard - when editing starts?
661
How to create delegates in Objective-C?
358
Create blurry overlay
269
Received Signal EXC_BAD_ACCESS
6
UIImage released, but CGImage not released
one
UIImage Blur with CIContext in background thread - crash with EXC_BAD_ACCESS
one
EXC_BAD_ACCESS on a CIContext Draw Image
0
OS X, Cocoa: How to highlight scorched areas of a photograph?
0
CIContext drawImage calls EXC_BAD_ACCESS - iOS 6
0
iPhone - trying to catch EXC_BAD_ACCESS error (it seems zombie problem)

All Articles