I have an app, which has been in production for about 8 years, which uses a live camera view for the purpose of capturing barcodes. The app configures the camera for continuous autofocus with this code:
if ([videoDevice isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]) {
videoDevice.focusMode = AVCaptureFocusModeContinuousAutoFocus;
}
This has worked fine for years, but a customer who just upgraded to an iPhone 14 says that it doesn't work on his phone; the image never focuses and the barcode cannot be read.
Has something changed recently, either in iOS or with the iPhone 14, that would render this code incorrect? Xcode does not flag it with any warnings.
Thanks, Frank
Hello,
Most likely the issue you are seeing is related to the fact that the wide angle camera's minimumFocusDistance of iPhone 14 Pro is further than previous iPhones. It's not that continuous autofocus isn't working, but rather the wide angle camera is unable to focus at this closer distance.
To resolve this, you should utilize one of the virtual cameras either the builtInDualWideCamera, or the builtInTripleCamera. These virtual cameras will (by default) automatically switch over to the ultra-wide angle camera when possible, to maintain focus of the subject.