Hello,
I am using simple AVCaptureDevice
setup to scan QR code from LCD screen, usually the distance is 5 to 15 centimeters. This has been working fine for a long time, with correct focus and everything.
Today I noticed that my iPhone 14 Pro cannot focus on these smaller distances while my developer iPhone SE 2020 can easily detect the QR code in basically all cases.
I have been using this code to create the capture device:
AVCaptureDevice.default(for: .video)
And then some settings:
if videoCaptureDevice.isAutoFocusRangeRestrictionSupported {
videoCaptureDevice.autoFocusRangeRestriction = .near
}
if videoCaptureDevice.isFocusModeSupported(.continuousAutoFocus) {
videoCaptureDevice.focusMode = .continuousAutoFocus
}
As I said, this worked great prior to noticing the issue on iPhone 14 Pro.
After some searching I found recommendations to use another device type like: builtInDualWideCamera
and other available types. I tried all of them and they either behave like the default (meaning I cannot scan the code unless I move the phone way out) or they always seem to use the 0.5 Ultra-Wide camera which looks weird and the scanning experience is not ideal.
What is the best approach to have QR scanning with these new phones?