I am having difficult times, for something which I think ought to be simple. I just want to light the flash when taking a picture in my iOS app. And all I tried failed or works
I noticed, configuring the AVCaptureDevice
, while the AVCaptureSession
contained an AVCaptureDeviceInput
reference caused this error. My solution was: before configuring an AVCaptureDevice
object, remove the AVCaptureDeviceInput
reference in the AVCaptureSession
and read it when completed. I would no longer get the error with this approach.
Example:
self.input = [AVCaptureDeviceInput deviceInputWithDevice:self.device error:&error];
. .
[self.session removeInput:self.input];
if ([device lockForConfiguration:NULL]) {
device.focusMode = AVCaptureFocusModeContinuousAutoFocus;
[device unlockForConfiguration];
}
[self.session addInput:self.input];