AFTER tapping to take picture, I want to lock exposure and turn off torch as soon as exposure is no longer adjusting. So, I added an observer to handle adj
It is almost certainly a timing issue. Call captureStillImageAsynchronouslyFromConnection:completionHandler:
inside your if
block. Then the capture will always be executed after exposure has been locked.
if ([self.inputDevice isExposureModeSupported:AVCaptureExposureModeLocked]) {
dispatch_async(dispatch_get_main_queue(),
^{
NSError *error = nil;
if ([self.inputDevice lockForConfiguration:&error]) {
//code to lock exposure here
//take photo here
}
});
}