Query background audio permissions

Is there a way for me to programmatically query whether if my AVAudioSession is able to play even when app is minimized/screen is locked? I need this to debug background audio permissions as my AVAudioSession keeps getting paused while app goes into background and it resumes once it goes into the foreground. Moreover, when I try to call setActive for AVAudioSession in didEnterBackground, it gives me the error code 561015905 which says it is permission related.

My Info.plist already has

<key>UIBackgroundModes</key>
<array>
    <string>audio</string>
</array>

added to it.

Query background audio permissions
 
 
Q