Saving AVAudioRecording at path
I managed to set up the AVAudiorecorder to make recordings, but I would
like to save the recording in the documents directory to listen to it
later. I tried this:
- (void) audioRecorderDidFinishRecording:(AVAudioRecorder *)avrecorder
successfully:(BOOL)flag{
ButtonStopRecording.hidden = YES;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory
stringByAppendingPathComponent:@"audioFile.ext"]; // Where ext is the
audio format extension you have recorded your sound
[avrecorder.data writeToFile:filePath atomically:YES];
}
but there is an error in
avrecorder.data
How can I solve the issue?
No comments:
Post a Comment