Closed jueyi1127 closed 5 years ago
* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This luminance source does not support cropping.' * First throw call stack: (0x180e6adb0 0x1804cff80 0x1000de6b4 0x1001036e0 0x1000dfd94 0x1000df7fc 0x10002d834 0x1000c0420 0x1005a9a7c 0x1005a9a3c 0x1005af4e4 0x180e20d50 0x180e1ebb8 0x180d48c50 0x182630088 0x186032088 0x1000333a0 0x1808e68b8) libc++abi.dylib: terminating with uncaught exception of type NSException
This is the code
UIImage *image = [UIImage imageWithCGImage:capture.lastScannedImage];
UIImageWriteToSavedPhotosAlbum(image,nil,nil,nil); ZXCGImageLuminanceSource *source = [[ZXCGImageLuminanceSource alloc] initWithCGImage:image.CGImage]; ZXBinaryBitmap *bitmap = [ZXBinaryBitmap binaryBitmapWithBinarizer:[ZXHybridBinarizer binarizerWithSource:source]]; ZXDecodeHints *hints = [ZXDecodeHints hints]; hints.tryHarder = YES; ZXMultiFormatReader *reader = [ZXMultiFormatReader reader]; ZXGenericMultipleBarcodeReader *multiReader = [[ZXGenericMultipleBarcodeReader alloc] initWithDelegate:reader]; NSError *error = nil; NSArray *results = [multiReader decodeMultiple:bitmap hints:hints error:&error]; for (ZXResult *result2 in results) { NSLog(@"Decoded barcode %@", result2.text); }
It fails in the creation of the NSArray *results, I can see the image saved fine to the photoalbum so I know the image is there so I don't understand why it crashes
Originally posted by @mattdouhan in https://github.com/TheLevelUp/ZXingObjC/pull/235#issuecomment-225394490
* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This luminance source does not support cropping.' * First throw call stack: (0x180e6adb0 0x1804cff80 0x1000de6b4 0x1001036e0 0x1000dfd94 0x1000df7fc 0x10002d834 0x1000c0420 0x1005a9a7c 0x1005a9a3c 0x1005af4e4 0x180e20d50 0x180e1ebb8 0x180d48c50 0x182630088 0x186032088 0x1000333a0 0x1808e68b8) libc++abi.dylib: terminating with uncaught exception of type NSException
This is the code
UIImage *image = [UIImage imageWithCGImage:capture.lastScannedImage];
It fails in the creation of the NSArray *results, I can see the image saved fine to the photoalbum so I know the image is there so I don't understand why it crashes
Originally posted by @mattdouhan in https://github.com/TheLevelUp/ZXingObjC/pull/235#issuecomment-225394490