I'm working with two application modules:
1) Recording module with this audioSession setup:
try audioSession.setCategory(AVAudioSessionCategoryRecord)
try audioSession.setMode(AVAudioSessionModeMeasurement)
try audioSession.setPreferredIOBufferDuration(0.05)
try self.audioSession.setActive(true)
2) Recording module with this audioSession setup:
try audioSession.setCategory(AVAudioSessionCategoryPlayback)
try audioSession.setMode(AVAudioSessionModeDefault)
try self.audioSession.setActive(true)
For each passage from 1->2 and 2-1 I have a try self.audioSession.setActive(false)
If I pass from 1) module to 2) or redo 1) all works fine. Than if from 2) I come to 1) I get this error on try self.audioSession.setActive(true)
This is the error:
ERROR: [0x16e10b000] >avae> AVAudioIONodeImpl.mm:365:
_GetHWFormat: required condition is false: hwFormat
What is this error related to? I can't find any help on Apple iOS documentation to understand where the problem can be.
Does anybody have any tip?
The problem turned up to be an iOS bug, there is an open issue regarding this problem in Apple Bug reporting which has ID 29890198. It is at the moment still opened.
As a work around I managed to solve the issue by setting AVAudioSessionCategoryPlayAndRecord in recording phase in place of AVAudioSessionCategoryRecord:
try audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord)
I suggest to track also the opened thread on Apple forum: https://forums.developer.apple.com/thread/73166
Hope it will soon be fixed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With