我使用Zbar进行一维条码扫描,但在升级到IOS 10之后,它再也无法读取多个条形码,它会在读取多个条形码时读取一个条形码,此外,相机视图显示绿色聚焦在单个条形码上的矩形,我认为这就是为什么它只读取该矩形内部的内容,这在IOS 9中从未发生过。
其他人看到了吗?
我的代码如下,之前没有问题,请注意我已删除了逻辑,以确保代码尽可能小,以重现问题。
- (IBAction)transactionListViewCameraBtn_Pressed:(id)sender {
// Below is using the Zbar lib
// ADD: present a barcode reader that scans from the camera feed
ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
reader.supportedOrientationsMask = ZBarOrientationMaskAll;
ZBarImageScanner *scanner = reader.scanner;
// EXAMPLE: disable rarely used I2/5 to improve performance
[scanner setSymbology: ZBAR_I25
config: ZBAR_CFG_ENABLE
to: 0];
[self presentViewController:reader animated:YES completion:nil];
[reader viewWillAppear:NO];
}
- (void) imagePickerController: (UIImagePickerController*) reader didFinishPickingMediaWithInfo: (NSDictionary*) info {
// ADD: get the decode results
id<NSFastEnumeration> results = [info objectForKey: ZBarReaderControllerResults];
ZBarSymbol *symbol = nil;
NSString *msg = @"BarCodes:";
for(symbol in results) {
// TODO run createTransactionFromBarcode
if ([NWTillHelper isDebug] == 1) {
NSLog(@"Zbar delegate holds barcode: %@", symbol.data);
msg = [msg stringByAppendingString:[NSString stringWithFormat:@"<-->%@", symbol.data]];
}
}
NSLog(@"kalle: %@", msg);
//[reader dismissModalViewControllerAnimated: YES];
}