我用 AVAudioRecorder.recordForDuration(5.0) 录制了5秒的声音 . 在我开始录制之前,我正在为一个图像设置动画,当录制器通过委托方法通知我们已经停止录制时,我会停止为图像设置动画 . 这里遇到的麻烦是,委托方法 audioRecorderDidFinishRecording 被召唤的时间差不多是半秒钟,而且我只是太糟糕了 . 出于调试目的,我决定跟踪每次操作花费的时间以及's obvious that it' s录音机的故障 .

所以问题是:我怎样才能加快AVAudioRecorder的速度?或者在磁盘上写这么昂贵的操作?

这是我的时间跟踪:

audio recorder notified us about finishing: 5.51931619644165
we stopped animations: 5.51980209350586
recording duration: 5.01551020408163

audio recorder notified us about finishing: 5.56378316879272
we stopped animations: 5.5641040802002
recording duration: 5.01551020408163

audio recorder notified us about finishing: 5.53574800491333
we stopped animations: 5.53613710403442
recording duration: 5.01551020408163

audio recorder notified us about finishing: 5.50653314590454
we stopped animations: 5.50678110122681
recording duration: 5.01551020408163