AVCaptureDevice.FocusMode cannot be set in iPhone15

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?

Hello,

Are there any further details you can provide about the issue? I am able to set locked focus and a custom lens position in a sample app on iPhone 15.

Basically the feature looks very unstable. The app we are developing is a little complicated one. I tried this same code to make a sample simple app. The adjusting focus is working perfectly. Weirdly, after running the sample app in my iPhone15, if I run our main app, which is a totally different app, focus adjustment starts working perfectly in the main app too. But once we make some change like updating iOS version, the focus adjustment in the main app stops working. But again, if we install and run the sample app, The main app starts to work perfectly. But the sample app is totally isolated from the main app. And the code to adjust focus is the same in both apps!

AVCaptureDevice.FocusMode cannot be set in iPhone15
 
 
Q