AVAudioSession.outputVolume not reporting correctly in iOS 18+ devices

I’m using the shared instance of AVAudioSession. After activating it with .setActive(true), I observe the outputVolume, and it correctly reports the device’s volume.

However, after deactivating the session using .setActive(false), changing the volume, and then reactivating it again, the outputVolume returns the previous volume (before deactivation), not the current device volume. The correct volume is only reported after the user manually changes it again using physical buttons or Control Center, which triggers the observer.

What I need is a way to retrieve the actual current device volume immediately after reactivating the audio session, even on the second and subsequent activations.

Disabling and re-enabling the audio session is essential to how my application functions.

I’ve tested this behavior with my colleagues, and the issue is consistently reproducible on iOS 18.0.1, iOS 18.1, iOS 18.3, iOS 18.5 and iOS 18.6.2. On devices running iOS 17.6.1 and iOS 16.0.3, outputVolume correctly reflects the current volume immediately after calling .setActive(true) multiple times.

This kind of thing is where I've had some success with a code-level developer technical support question. Sometimes, you'll get an answer on the forum here, but more often not.

It seems like a genuine regression, and one that you could report with a small test app and good steps-to-reproduce. You file the bug first, then ask for code level support; "hey, this worked in older OS versions, how do I make it work on the current OS"?

At worst, you get an answer like "oops, we broke it, it will be fixed in future, there's no workaround", but at least it is an answer and you don't have to spend your time poking around in the dark trying to find non-existent workarounds.

AVAudioSession.outputVolume not reporting correctly in iOS 18+ devices
 
 
Q