AVAudioPlayerNode play() crashes app after coming back from background only on older devices with iOS 13

App launches. Audio engine is set up with nodes/mixer/etc and background audio starts playing (in background only when app is running). At some point user navigates to certain view which pauses the background audio. Now user puts app to background and re-opens it again. Closing this certain view should resume the background audio. This resuming MOSTLY works. Newer devices have no problem with this (iPhone X with iOS 12 & 13). **Crash happens with iPhone 7 Plus which has iOS 13**. Also, the same iPhone 7 Plus with iOS 12 doesn't crash.



I'm not doing anything special ... I just call play() on AVAudioPlayerNode.



When coming back from background, what happens to audio engine? Why only iPhone 7 (Plus) crashes? And why only iOS 13? Is there something extra to be done on iOS 13 when coming back from background?

Accepted Reply

It seems that I just haven't managed interruptions ... at all 🙂


I don't know how things worked as they did but as soon as I handled interruptions properly there was no more crash. Here's a link to the document that helped me: https://developer.apple.com/documentation/avfoundation/avaudiosession/responding_to_audio_session_interruptions

Replies

It seems that I just haven't managed interruptions ... at all 🙂


I don't know how things worked as they did but as soon as I handled interruptions properly there was no more crash. Here's a link to the document that helped me: https://developer.apple.com/documentation/avfoundation/avaudiosession/responding_to_audio_session_interruptions