我设法设置了 AVAudiorecorder 进行录音,但我想将录音保存在文档目录中以便以后收听。我试过这个:
- (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];
}
但有一个错误
avrecorder.data
我该如何解决这个问题?