我有以下代码段。
camera.onDeviceChange = { [weak self] (camera: LLSimpleCamera!, device: AVCaptureDevice!) -> Void in
print("Device changed.")
}
这在Swift 2中曾经工作正常,但是现在我收到以下错误消息:
无法分配类型的值'(llsimplecamera!,avcapturedevice!) -> void'to type'((llSimpleCamera?,avcapturedevice?) -> void)!'
)!
不太确定如何更改它,我尝试通过更改!到选项,然后添加!空隙之后,这无效。
您的错误建议类型不匹配,这意味着LLSimpleCamera! != LLSimpleCamera?
..无需定义类型。..您可以使用
camera.onDeviceChange = { [weak self] (camera, device) -> Void in
print("Device changed.")
}