I'm trying to read QR code with Zxing :
self.capture = [[ZXCapture alloc] init];
self.capture.rotation = 90.0f;
// Use the back camera
self.capture.delegate = self;
self.capture.camera = self.capture.back;
self.capture.layer.frame = self.view.bounds;
[self.view.layer addSublayer:self.capture.layer];
I'm getting this error :
* Terminating app due to uncaught exception 'NSGenericException', reason: '* AVCaptureSession can't startRunning between calls to beginConfiguration / commitConfiguration'
It can work, if so
self.capture = [[ZXCapture alloc] init];
self.capture.rotation = 90.0f;
// Use the back camera
self.capture.camera = self.capture.back;
self.capture.layer.frame = self.view.bounds;
[self.view.layer addSublayer:self.capture.layer];
self.capture.delegate = self; // this must be last.
Hotfix Suggestion:
Go into [ZXCapture start] and look comment the dispathc_asyn part:
// NSLog(@"start running");
// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[self.session startRunning];
// });
I won't crash anymore but you will then block your main thread for the time the session needs to start -> Hotfix till the guys from zxing come up with a solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With