Как только вы потеряете запись, вы должны снова перезапустить аудиозапись, и вы ДОЛЖНЫ быть на переднем плане, чтобы сделать это.Вы можете захватывать события прерывания звука для прерванного и прерванного завершения.НО в настоящее время есть ошибки в этом, и вы много не получите завершенных событий.
AVCaptureSession *captureSession;
.......
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioInterruptionEnded) name:AVCaptureSessionInterruptionEndedNotification object:captureSession];
[captureSession addObserver: self forKeyPath:@"running" options:0x3 context:nil];
[captureSession addObserver: self forKeyPath:@"interrupted" options:0x3 context:nil];
Существует два способа захвата звука.Использование сеанса AVCapture более высокого уровня или AudioQueue нижнего уровня, но оба они ограничены первым абзацем.
- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if ([keyPath isEqualToString:@"interrupted"])
{
// try restart here if in foreground
// post local notification if in background to bring to foreground and then restart
}
}