AVAudioSession setActive(true) fails after phone call when app is in background

I’m seeing what appears to be an iOS audio-session issue that occurs only when a phone call happens while the app is in the background.

API: AVAudioSession, AVAudioRecorder

Background Modes: Audio enabled (UIBackgroundModes = audio)

Category: .playAndRecord

Microphone permission: granted

Expected Behavior

If the app is recording audio in the background and a phone call interrupts it: AVAudioSession.interruptionNotification(.began) fires

Call ends AVAudioSession.interruptionNotification(.ended) fires App should be able to re-activate its audio session and resume or restart recording

Apple documentation suggests this should be supported for background audio apps.

Actual Behavior

When the app is in the background and phone call is ended: AVAudioSession.interruptionNotification(.ended) does fire Attempting to reactivate the audio session always fails:

Error Domain=NSOSStatusErrorDomain
Code=560557684 ("!int")
"Session activation failed"

The session appears to remain permanently “interrupted”

Retrying activation (with delays) does not help

Recreating AVAudioRecorder does not help

Reactivation works only after the app is opened again

AVAudioSession setActive(true) fails after phone call when app is in background
 
 
Q