0

When accessing the camera and trying to capture a still, I get an error adding the output settings. It says that I can't add a nil to AVCaptureOutput

Here's the code:

var imageCaptured : AVCaptureStillImageOutput?

let outputSettings:Dictionary = [AVVideoCodecJPEG:AVVideoCodecKey]
imageCaptured?.outputSettings = outputSettings
captureSession.addOutput(imageCaptured) //error here

This is the error:

* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* Can't add a nil AVCaptureOutput'

4

1 回答 1

1

你没有设置imageCaptured任何东西。是零。

例如如何初始化它,请参阅如何使用 AVCaptureStillImageOutput 来拍照

于 2014-12-04T03:52:01.097 回答