我制作了2个iPhone应用程序,可以录制音频并将其保存到文件中并再次播放.
其中一个使用AVAudiorecorder和AVAudioplayer.第二个是Apple的SpeakHere音频队列示例.
两者都运行在Simulater和Device上.
但是,当我重新启动任一应用程序时,找不到录制的文件!我已经尝试了在stackoverflow上找到的所有可能的建议,但它仍然无法正常工作!
这是我用来保存文件的方法:
NSArray *dirPaths;
NSString *docsDir;
dirPaths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES);
docsDir = [dirPaths objectAtIndex:0];
NSString *soundFilePath = [docsDir stringByAppendingPathComponent:@"sound1.caf"];
NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];
Run Code Online (Sandbox Code Playgroud)