Swift isLockingFocusWithCustomLensPositionSupported始终返回false

问题描述 投票:0回答:1

我想将iPhoneX的镜头距离设置为恒定值。为了检查是否支持该功能,我检查了设备的isLockingFocusWithCustomLensPositionSupported属性,如此处的文档所述:https://developer.apple.com/documentation/avfoundation/avcapturedevice/2361529-islockingfocuswithcustomlensposi

即使设备被锁定进行配置,该方法也始终返回false,这意味着调用方法setFocusModeLocked(lensPosition, completionHandler)总是会引发错误。为什么会这样,以及如何正确调用setFocusModeLocked()

下面是我的方法:

let device = self.deviceInput.device 
do { 
     try device.lockForConfiguration() 
     if device.isFocusPointOfInterestSupported && device.isFocusModeSupported(focusMode) 
     { 
      // this return true 
     } 
     if device.isLockingFocusWithCustomLensPositionSupported 
     { 
       //this always returns false
       device.setFocusModeLocked(lensPosition: focusDistance, completionHandler: nil) 
     } 
     device.unlockForConfiguration() 
   } catch { print("Could not lock device for configuration: \(error)") }

[在iPhoneX,iOS 12上测试

swift avcapturedevice avcapture avcam
1个回答
0
投票

这个问题有什么进展吗?我有同样的问题,似乎无法发现如何解决]

© www.soinside.com 2019 - 2024. All rights reserved.