Ron
Ron

Reputation: 514

iOS App: unrecognized selector sent to instance - Recording video AVFoundation

I keep getting the following error message from my developed app:

[AVCaptureVideoDataOutput startRecordingToOutputFileURL:recordingDelegate:]: unrecognized selector sent to instance 0x190e10

The code for this is from the following button to record video:

- (IBAction)takeVideo {
    AVCaptureMovieFileOutput *movieFileOutput = [[AVCaptureMovieFileOutput alloc] init];

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectoryPath = [paths objectAtIndex:0];
    NSString *movieFileName = [NSString stringWithFormat: @"something.mov"];
    NSString *mypath = [documentsDirectoryPath stringByAppendingPathComponent:movieFileName];
    NSURL *outputURL = [[NSURL alloc] initFileURLWithPath:mypath];

    [self.captureSession addOutput:movieFileOutput];
    [movieFileOutput startRecordingToOutputFileURL:outputURL recordingDelegate:self];
    [outputURL release];
}

What have I done wrong?

Please help

Upvotes: 1

Views: 154

Answers (1)

Krumelur
Krumelur

Reputation: 32557

Your class probably does not implement all the required methods of the AVCaptureFileOutputRecordingDelegate protocol: specifically, you need to implement captureOutput:didFinishRecordingToOutputFileAtURL:fromConnections:error:

See the documentation.

Upvotes: 1

Related Questions