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'