Im using ZXing framework to make an barcode image out of a string. When i try it on the simulator it work, but when I try it on a device, I get a bad access error
ZXMultiFormatWriter *writer = [ZXMultiFormatWriter writer];
ZXBitMatrix* result = [writer encode:self.discountProgramInfo.customerID
format:self.barcodeFormat
width:self.barcodeImageView.frame.size.width
height:self.barcodeImageView.frame.size.height
error:&error];
if (result) {
CGImageRef image = [[ZXImage imageWithMatrix:result] cgimage];
self.barcodeImageView.image = [UIImage imageWithCGImage:image];
// This CGImageRef image can be placed in a UIImage, NSImage, or written to a file.
} else {
NSString *errorMessage = [error localizedDescription];
DLog("%@",errorMessage);
}
It fails on this line: self.barcodeImageView.image = [UIImage imageWithCGImage:image];
and the CGImageRef
is not generated properly.
Any ideas what could be causing the mismatch?