New issue has come up as I've moved to Swift. This code worked in Objc but now its broken.
func captureImage()
{
var videoConnection:AVCaptureConnection = AVCaptureConnection()
for connection in _stillImageOutput.connections
{
}
}
For some reason, if I run the above loop I get an EXC_BAD_ACCESS code 1 on the last line.
_stillImageOutput is just an AVCaptureStillImage object and its not nil
Commenting out the var videoConnection:AVCaptureConnection = AVCaptureConnection() stops this crash.
Any ideas?
Turns out had nothing to do with the for loop
Doing var videoConnection:AVCaptureConnection = AVCaptureConnection() is what caused the crash.
Changing it to var videoConnection:AVCaptureConnection! fixed the issue