captureStillImageAsyncronouslyFromConnection - 无法转换表达式的类型

captureStillImageAsyncronouslyFromConnection - Cannot convert the expression's type

我刚接触 Swift,所以我仍在完善一些更精细的细节;如果我遗漏了一些明显的东西,我深表歉意。我四处浏览并找到了针对不同方法调用中类似错误的解决方案,但这些答案并没有帮助我解决我的问题。我打这个电话

    captureOutput.captureStillImageAsynchronouslyFromConnection(port) {
        (imageDataSampleBuffer: CMSampleBufferRef?, error: NSError?) -> Void in
        // TODO
    }

标记有以下错误:

Cannot convert the expression's type '(@lvalue AVCaptureInputPort, (CMSampleBufferRef?, NSError?) -> Void)' to type 'AVCaptureConnection!'

问题显然出在我的关闭上。非常感谢任何帮助。

The issue is clearly with my closure

实际上,没有。问题显然出在 port。此参数应该是 AVCaptureConnection - 但您提供的是 AVCaptureInputPort。