danielebogo / DBCamera

DBCamera is a simple custom camera with AVFoundation
MIT License
1.26k stars 262 forks source link

Inconsistent state #173

Open sciutand opened 8 years ago

sciutand commented 8 years ago

I've been using DBCamera manager for a while. In the latest release I'm getting quite a few of these:

Fatal Exception: NSInternalInconsistencyException
*** -[AVCaptureStillImageOutput captureStillImageAsynchronouslyFromConnection:completionHandler:] - inconsistent state.

stack trace:

ReceiptBank 
DBCameraManager.m line 154
-[DBCameraManager captureImageForDeviceOrientation:]

ReceiptBank 
DBCameraViewController.m line 405
-[DBCameraViewController cameraViewStartRecording]

ReceiptBank 
DBCameraView.m line 352
-[DBCameraView triggerAction:]

I've only replicated it once, the camera shows up black (somehow failed to initialise I guess) and upon pressing the capture button the crash occurs. In the wild the crash is occurring quite a often. I'm not sure what part of my code could cause the camera to show up black randomly. I do dismiss the camera controller when the app goes in the background and recreate a new one when going in foreground if needed.