Random 561015905 on AVAudioSession setActive

I'm trying to make an app that plays audio when push is received, even while the ringer is silent.


I have the audio background mode enabled and the app works (usually) fine, but sometimes i get a mysterious 561015905 error.


The error is

AVAudioSession.ErrorCode.cannotStartPlaying

And docs indicate:

This error type can occur if the app’s Information property list doesn’t permit audio use.
It can also occur if the app is in the background and using a category that doesn’t allow background audio.

https://developer.apple.com/documentation/avfoundation/avaudiosession/errorcode/cannotstartplaying


However, the audio mode is definitely enabled and the category is always playback that should allow background playing.

(this works 95-99% of times)


So, with intesnse testing i have found that once every 20-100 incoming pushes i get this error:

Error: Error Domain=NSOSStatusErrorDomain Code=561015905 "(null)"


Why?

Did you solve your issue? I'm having the same problem.

Also seeing this A LOT. Many users are having this error.

Random 561015905 on AVAudioSession setActive
 
 
Q