用下面的代碼我得到這個錯誤:功能錯誤處理
Cannot convert value of type 'inout NSError?' (aka 'inout Optional') to expected argument type '()'
和它在這行代碼:
if device.lockForConfiguration(&error)
下面的代碼的其餘部分:
func focusWithMode(focusMode:AVCaptureFocusMode, exposureMode:AVCaptureExposureMode, point:CGPoint, monitorSubjectAreaChange:Bool){
dispatch_async(self.sessionQueue!, {
var device: AVCaptureDevice! = self.videoDeviceInput!.device
var error: NSError? = nil
if device.lockForConfiguration(&error){
if device.focusPointOfInterestSupported && device.isFocusModeSupported(focusMode){
device.focusMode = focusMode
device.focusPointOfInterest = point
}
if device.exposurePointOfInterestSupported && device.isExposureModeSupported(exposureMode){
device.exposurePointOfInterest = point
device.exposureMode = exposureMode
}
device.subjectAreaChangeMonitoringEnabled = monitorSubjectAreaChange
device.unlockForConfiguration()
}
})
}
我的猜測是斯威夫特2和try/catch VS錯誤,但OP正在忸怩作態來考驗我們。 – zaph
@jtbandes這是錯誤:無法轉換'inout NSError'類型的值? (aka'inout可選')與預期參數類型'()' –
不要告訴我 - 告訴所有人。 [編輯]你的問題,並輸入所需的信息。見[問]。 – jtbandes