You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Xcode14.3中Type '[AVCaptureDevice.DeviceType]'无builtInWideAngleCamera成员错误修复

错误修复:Type '[AVCaptureDevice.DeviceType]' has no member 'builtInWideAngleCamera'

错误原因

AVCaptureDevice.DiscoverySession的deviceTypes参数要求传入数组类型的设备枚举集合,但你直接传了单个枚举值.builtInWideAngleCamera,编译器无法识别,因此抛出错误。

最简单的修复方法

把.builtInWideAngleCamera放到数组中,用方括号[]包裹即可,修改后的完整代码如下:

if let availableDevices = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInWideAngleCamera], mediaType: 
    AVMediaTypeVideo, position: .back).devices {
    captureDevice = availableDevices.first
    beginSession()
}

额外补充

如果后续需要同时指定多个摄像头类型(比如广角+超广角),直接在数组里添加对应的枚举值即可,示例:[.builtInWideAngleCamera, .builtInUltraWideCamera]

内容的提问来源于stack exchange,提问作者vivia

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.13 11:24:59