Can't get pixel data via CGDataProviderCopyData using AVCaptureVideoDataOutput in swift 2
I'm working on updating this for swift 2.0 and I currently get fatal error: unexpectedly found nil while unwrapping an Optional value on line: let data = CGDataProviderCopyData(CGImageGetDataProvider(imageRef)) as! NSData func captureOutput(captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, fromConnection connection: AVCaptureConnection!) { print("Capture output running") let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) CVPixelBufferLockBaseAddress(imageBuffer!, 0) let baseAddress = CVPixelBufferGetBaseAddressOfPlane(imageBuffer!, 0) let