I'm simply trying to satisfy the arguments for the function below to bring up the audio recorder. I believe the issue is with the completion block. The error given in debug is :
presentAudioRecordingControllerWithOutputURL:preset:maximumDuration:actionTitle:completion: requires a non-NULL URL and completion block
NSBundle* myBundle = [NSBundle mainBundle];
NSURL* recording = [myBundle URLForResource:@"recording" withExtension:@"mp4"];
[self presentAudioRecordingControllerWithOutputURL:recording
preset:WKAudioRecordingPresetWideBandSpeech
maximumDuration:5000
actionTitle:@"Recording"
completion:^(BOOL didSave, NSError *error) {
if (error != nil)
{
NSLog(@"Error: %@",error);
}
else if(didSave == YES)
{
NSLog(@"Saved the recording");
}
}];
I guess your file URL
recording
is wrong. You can't record into the "main bundle". So NSURL object couldn NOT be created and occurred the non-NULL error.For example, you would be able to record into the documents directory as follows: