4

I'm using AudioUnit to handle the audio record and replay.

And I add audio to UIBackgroundModes key in info.plist to keep it recording or playing when enter background.

The problem is: when my app is not recording or playing audio, the app still running in background, and I can see the red alert bar when device locked or in home screen.

So, how can I enable my app to be suspended when it is not recording to save batt life? Just like before adding the UIBackgroundModes key?

JonnyHan
  • 97
  • 4

1 Answers1

2

Finally, I figured it out today. I stop the audio file writing procedure, but do not stop audio session. By add AudioSessionSetActive(NO) when stop playing, the problem solved.

JonnyHan
  • 97
  • 4