使用ZXingObjc 存在无法解析某些二维码的bug
一、问题描述
NtQRCode对MA68的部分分享图片中的二维码无法解析
示例:
一般是对一些分辨率比较高的图片才存在该问题
按照ZXing的示例代码,接口调用方法如下:
UIImage *image = [指定图片的UIImage对象]; ZXLuminanceSource *source = [[ZXCGImageLuminanceSource alloc] initWithCGImage:image.CGImage]; ZXBinaryBitmap *bitmap = [ZXBinaryBitmap binaryBitmapWithBinarizer:[ZXHybridBinarizer binarizerWithSource:source]]; NSError *error = nil; [hints addPossibleFormat:kBarcodeFormatQRCode]; ZXMultiFormatReader *reader = [ZXMultiFormatReader reader]; ZXResult *result = [reader decode:bitmap hints:nil error:&error]; 返回的result中对应的内容为空,error不为空 返回Error内容如下: Error=Error Domain=ZXErrorDomain Code=1002 "A barcode was not found in this image" UserInfo={NSLocalizedDescription=A barcode was not found in this image}
这个问题在网上也可以看到其他人上报了该问题
github上ZXingObjC的issue https://github.com/TheLevelUp/ZXingObjC/issues/245 "再见ZXing 使用系统原生代码处理QRCode