错误消息表明您有条件地将非可选类型强制转换为冗余的可选类型.
⌥-click在devices检查其声明
devices
class func devices() -> [AVCaptureDevice]
所以很简单
let devices = AVCaptureDevice.devices() // Loop through all the capture devices on this phone for device in devices { ...