我将 ZXing 用于应用程序,这与 ZXing 原始代码主要是相同的代码,只是我允许连续扫描几次(即,一旦检测到某些东西,ZXingWidgetController 就不必立即关闭)。
当我按下呼叫的关闭按钮时,我经历了长时间的冻结(有时它永远不会结束)
- (void)cancelled {
// if (!self.isStatusBarHidden) {
// [[UIApplication sharedApplication] setStatusBarHidden:NO];
// }
[self stopCapture];
wasCancelled = YES;
if (delegate != nil) {
[delegate zxingControllerDidCancel:self];
}
}
和
- (void)stopCapture {
decoding = NO;
#if HAS_AVFF
if([captureSession isRunning])[captureSession stopRunning];
AVCaptureInput* input = [captureSession.inputs objectAtIndex:0];
[captureSession removeInput:input];
AVCaptureVideoDataOutput* output = (AVCaptureVideoDataOutput*)[captureSession.outputs objectAtIndex:0];
[captureSession removeOutput:output];
[self.prevLayer removeFromSuperlayer];
/*
// heebee jeebees here ... is iOS still writing into the layer?
if (self.prevLayer) {
layer.session = nil;
AVCaptureVideoPreviewLayer* layer = prevLayer;
[self.prevLayer retain];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 12000000000), dispatch_get_main_queue(), ^{
[layer release];
});
}
*/
self.prevLayer = nil;
self.captureSession = nil;
#endif
}
(请注意删除视图的dismissModalViewController在委托方法中)
仅当我连续进行多次扫描且仅在 iPhone 4 上(4S 不会冻结)时,我才会在解散时遇到冻结
任何的想法 ?
干杯
只读存储器