ios - iPhone X swift 4 中的 setExposureModeCustom 崩溃

标签 ios swift avfoundation iphone-x

我有一个应用程序,它将访问相机的曝光模式设置,以使用自定义值更改相机的快门速度。它在大多数设备上都按预期工作,除了 iPhone X。下面是我正在使用的代码,

do {
    try captureDevice.lockForConfiguration()
    captureDevice.setExposureModeCustom(duration: CMTimeMake(1,30), iso: 120, completionHandler: { (time) in
})
    captureDevice.unlockForConfiguration()
} catch {
    debugPrint(error)
}

它在上一行崩溃了,崩溃日志说要检查是否 isExposureModeSupported

crash log screenshot .

我的问题是,我们可以检查isExposureModeSupported,但是否所有 iPhone X 设备都不支持自定义曝光模式?如果可以,我们如何才能在 iPhone X 中支持自定义曝光模式?

或者我们需要更改相机设置中的任何内容吗?

有人可以帮忙吗?

最佳答案

iPhone x does support custom exposure, but when the builtInDualCamera device is selected all the custom settings are disabled.您只需要使用其他设备,builtInWideAngleCamerabuiltInTelephotoCamera

关于ios - iPhone X swift 4 中的 setExposureModeCustom 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48941539/

相关文章:

iphone - NSArray removeObjectAtIndex 错误

c# - Xamarin iOS 错误 : Can not resolve reference

ios - Swift Mapkit 自动搜索业务

arrays - 是否可以检查 swift 数组中的所有值是否为真而不是一个一个地循环?

ios - AVAssetTrack 看不到 AVMediaTypeAudio

ios - swift 3 : Rerecord video through AVFoundation

objective-c - 为什么在预设为 640x480 时使用 AVFoundation 捕获图像会给我 480x640 图像?

Wordpress CMS 中的 iPhone 中间件/客户区?

ios - Apple Watch 站立检测

ios - 如何更新已保存在 Swift 中的 CoreData 条目?