gpt4 book ai didi

ios - 尝试打开相机 View 时 zbar 卡住

转载 作者:行者123 更新时间:2023-11-29 12:47:31 26 4
gpt4 key购买 nike

我正在使用 zbar sdk 扫描条形码。问题是有时它在尝试打开相机 View 时会卡住。这可能需要 1-4 分钟。它太长而且很烦人,但有时它打开得很快。我该如何解决这个问题?谢谢。

-(void)barcodeRead
{
reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
reader.supportedOrientationsMask = ZBarOrientationMaskAll;

ZBarImageScanner *scanner = reader.scanner;
// TODO: (optional) additional reader configuration here

// EXAMPLE: disable rarely used I2/5 to improve performance
[scanner setSymbology: ZBAR_I25
config: ZBAR_CFG_ENABLE
to: 0];

// present and release the controller
[self presentViewController: reader
animated: YES completion:nil];

}

- (void) imagePickerController: (UIImagePickerController*) reader
didFinishPickingMediaWithInfo: (NSDictionary*) info
{
// ADD: get the decode results
id<NSFastEnumeration> results =
[info objectForKey: ZBarReaderControllerResults];
ZBarSymbol *symbol = nil;
for(symbol in results)
break;
// EXAMPLE: do something useful with the barcode image
if(whichbtn==1){pushed=1;
resultText1.text=symbol.data;
resultImage1.image= [info objectForKey: UIImagePickerControllerOriginalImage];
}else{if(whichbtn==2){pushed=1;
resultText2.text=symbol.data;
resultImage2.image= [info objectForKey: UIImagePickerControllerOriginalImage];
}
}
// ADD: dismiss the controller (NB dismiss from the *reader*!)
[reader dismissViewControllerAnimated: YES completion:nil];


}

最佳答案

- (void)viewDidLoad
{
[super viewDidLoad];

reader = [ZBarReaderViewController new];
}

//将这一行放在 viewDidLoad 方法中。

关于ios - 尝试打开相机 View 时 zbar 卡住,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23288127/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com