Disable app background when sound is not activated

I use AudioUnit for audio processing and playback.

And I add audio to the UIBackgroundModes key in info.plist to save it when recording or playing back when entering the background.

The problem is this: when my application does not record or play audio, the application is still running in the background, and I see a red warning bar when the device is locked or on the main screen.

So, how can I turn on my application to pause when it is not recording to save life in battle? Like before adding the UIBackgroundModes key?

+4
source share
1 answer
Finally, I realized this today. I stop the process of recording audio files, but I do not stop the audio session. By adding AudioSessionSetActive (NO) when stopping playback, the problem is resolved.
+2
source

Source: https://habr.com/ru/post/1495061/


All Articles