We are also getting an EXC
BADACCESS error when using the code from this thread. It does not occur every time the image is scaled, but rather around 1 in every 20 times. The error occurs at the line
UIImage *imageCopy = [UIGraphicsGetImageFromCurrentImageContext() retain];
When trying to track it down, we did manage to get the following error:
Tue Aug 12 17:24:46 Benoit HelloWorld[3858] <Error>: CGContextConcatCTM: invalid context
Could the crash be related to that error?
The images we are scaling are the UIImages passed to the delegate of our UIImagePickerController. As far as we can tell we're not doing anything differently the few times it crashes.
Here is a stack trace:
#0 0x30fd96d8 in CGGStateGetRenderingIntent ()
#1 0x33ae17f8 in ripc_RenderImage ()
#2 0x33ae8888 in ripc_DrawImage ()
#3 0x30fe0adc in CGContextDelegateDrawImage ()
#4 0x30fe0a48 in CGContextDrawImage ()
#5 0x000033b4 in -[ImagePickerViewDelegate scaleAndRotateImage:] (self=0x14b9a0, _cmd=0xa880, image=0x15c9b0) at /Users/martine/workspace/app/Classes/ImagePickerViewDelegate.m:248
#6 0x0000232c in -[ImagePickerViewDelegate useImage:] (self=0x14b9a0, _cmd=0xa874, image=0x15c9b0) at /Users/martine/workspace/app/Classes/ImagePickerViewDelegate.m:50
#7 0x306761f0 in -[NSThread main] ()
#8 0x306760be in _NSThread__main_ ()
#9 0x3143cc50 in pthreadbody ()
#10 0x00000000 in ?? ()
Any ideas would be greatly appreciated, thanks!