tags:

views:

83

answers:

0

My following code is giving the error:

UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

CGImageRef inImage = viewImage.CGImage;

CGContextRef cgctx = [self createARGBBitmapContextFromImage:inImage];

if (cgctx == NULL) { return nil; /* error */ }

size_t w = CGImageGetWidth(inImage);

size_t h = CGImageGetHeight(inImage);

CGRect rect = {{0,0},{w,h}};

//In the following line it's crashing in device but working fine in simulator

CGContextDrawImage(cgctx, rect, inImage);

and Error is: EXC_BAD_ACCESS (and CGBlendABGR8888toARGB8888 on the top of the function called list) Working fine in simulator but giving error while running in device(3.1 is iPhone OS) Please Help.