I have the following code to (re)start AVAudioEngine
wired up to AVAudioEngineConfigurationChangeNotification
:
do {
try self.engine.start()
} catch {
DDLogError("could not start sound engine")
self.soundEnabled = false
return
}
self.engine is defined as
private let engine = AVAudioEngine()
However, I frequently receive crash reports via Crashlytics saying
Fatal Exception: com.apple.coreaudio.avfaudio error 561015905
on the line containing the try self.engine.start()
.
561015905 is AVAudioSessionErrorCodeCannotStartPlaying
and from what I understand, this should be a NSError
error code, not an exception, which should be caught by my blank catch
in the code above. Still, the app just seems to crash at that point. What am I missing?
I know there are situations where the app wakes up in the background where this error can occur and I would be fine with that, as long as I can somehow catch it happening, as I thought I could with do/catch
.
AVAudioEngine
. – EdbertAVAudioEngine
because of this bug. Apple has since asked us to reproduce the bug with newer iOS versions (and automated message sent to open reports when new SDK versions are released) but since the issue is no longer of interest to us, we didn't do so. Meaning if you still care, you should probably open your own bug report. Sorry I couldn't be of more help, good luck tackling this. If you ever do, I'd love to hear back! – Edbert