Daniel S.
Daniel S.

Reputation: 6640

Why audio recording in background on iOS not working?

I'm trying to make my audio recorder work in the background on iOS.

I tried setting the background mode "audio" to prevent my app from being suspended when it enters background mode, but that doesn't seem to work. I did that by following Implementing Long-Running Background Tasks > Playing and Recording Background Audio, which states that

You enable audio support from the Background modes section of the Capabilities tab in your Xcode project. (You can also enable this support by including the UIBackgroundModes key with the audio value in your app’s Info.plist file.)

The problem is that when my app goes to background, only about one second of further audio is recorded. The app seems to be suspended thereafter. I test this on Simulator by simulating a home button press.

What can I do to make the app record in the background?

Upvotes: 0

Views: 783

Answers (1)

MDB983
MDB983

Reputation: 2454

An audio playing app on the simulator exhibits the same symptoms as you described for your recording app. In general, background tasks don't behave in the same way on the simulator and on devices.

Try testing the App on a device.

Upvotes: 1

Related Questions