We are developing an app which uses AVCaptureSession. Here is a part of my code:
if context.config.basic_settings.auto_focus == 1 {
// 自動フォーカス
device.focusMode = AVCaptureDevice.FocusMode.continuousAutoFocus
completion()
} else {
device.focusMode = AVCaptureDevice.FocusMode.locked
var _lenspos = Float(context.config.basic_settings.lens_position) ?? 0.5
if _lenspos > 1.0 { _lenspos = 1.0 }
if _lenspos < 0.0 { _lenspos = 0.0 }
device.setFocusModeLocked(lensPosition: _lenspos, completionHandler: { (time) in
completion()
})
}
This code can successfully set focus mode to autofoucs or manual focus and also can set lens position perfectly if we use iPhone13 or iPhone14. But If we use iPhone15, this code cannot set the focus mode or lensposition. We also tried with different iPhone15 devices, but the result is always the same(fails to set focus). And also used different iPhone13 and iPhone14 devices. But these iPhones can set the focus correctly everytime. Is it a bug of iPhone15? Or is there anything that I can do about the issue?