iPhone - AVAudioSession - AVAudioRecorder - 在设备休眠时发出问题

时间:2011-03-02 21:10:52

标签: avaudiorecorder avaudiosession

我正在试图弄清楚即使设备进入睡眠状态(或者让设备无法进入睡眠状态),也能保持AVAudioRecorder的录音。

根据this question,我只需要向AVAudioSession添加category,但这似乎不起作用。

我还发现MMPDeepSleepPreventer,但每次播放静音时都会中断录音。

有没有办法让AVAudioRecorder在设备休眠后继续录制。或者有没有办法让设备首先停止睡眠?


AVAudioSession *audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory :AVAudioSessionCategoryPlayAndRecord error:NULL];

1 个答案:

答案 0 :(得分:0)

您可以通过添加
来停止设备进入休眠状态 [UIApplication sharedApplication] .idleTimerDisabled = YES; 但我不确定Apple是否鼓励使用它。