Taras Palczynski Taras Palczynski - 2 months ago 11
Swift Question

Type does not conform to protocol 'AVCaptureFileOutputRecordingDelegate'

I am trying to use AVCaptureMovieFileOutput.startRecordingToOutputFileURL to record audio to a file, and the syntax for the function asks for a variable of type "AVCaptureFileOutputRecordingDelegate." All of the help I've seen from this site says that you need to make a class an extension of AVCaptureFileOutputRecordingDelegate, and NSObject.

Problem is, I always get the error: Type 'AVRecordDevices' does not conform to protocol 'AVCaptureFileOutputRecordingDelegate'

How do I fix it?

Class with error

P.S. I am developing for OS X if that means anything in this situation.

Answer

It means that you don't have the proper methods implemented in your view controller:

By taking a closer look at appleĀ“s docs you'll see that is mandatory to have at least this:

  func captureOutput(captureOutput: AVCaptureFileOutput!, didFinishRecordingToOutputFileAtURL outputFileURL: NSURL!, fromConnections connections: [AnyObject]!, error: NSError!)
    {
    }

https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVCaptureFileOutputRecordingDelegate_Protocol/