这是
Swift 2.我似乎无法找到任何相关内容.我收到了错误
Cannot invoke 'lockForConfiguration' with an argument list of type '(() -> ())'
在这里的第二行.
if let device = captureDevice { device.lockForConfiguration() { device.videoZoomFactor = 1.0 + CGFloat(ratioValue) device.unlockForConfiguration() } print(ratioValue) }
@R_404_323@
在Swift 2中,方法lockForConfiguration不接受任何参数,而是可以抛出NSError.您应该将它包装在do-try-catch语句中.
do { try device.lockForConfiguration() } catch { // handle error return } // When this point is reached,we can be sure that the locking succeeded device.videoZoomFactor = 1.0 + CGFloat(ratioValue) device.unlockForConfiguration()