Rectangle 27 0

ios Swift 2.0 Type '()' does not conform to protocol?


if let device = captureDevice {
    do {
        try device.lockForConfiguration()
        device.focusPointOfInterest = focusPoint
        device.focusMode = AVCaptureFocusMode.ContinuousAutoFocus
        device.exposurePointOfInterest = focusPoint
        device.exposureMode = AVCaptureExposureMode.ContinuousAutoExposure
        device.unlockForConfiguration()
    }
    catch {
        print("Error")
    }
}

I think that the following code should work for you:

It looks that lockForConfiguration returns Void and throws, so return value does not conform to BooleanType.

Yes you are right. I just realised if the try statement will fail it'll skip to the catch not executing code, otherwise will continue normally.

Note