Search code examples
iosaudiobackgroundaudio-recording

Background audio recording


I wish to record audio when my app is not active. Currently AVAudioRecorder works great for active mode of app. But inactive mode is unpredictable.

AVAudioRecorder can be used for inactive also? Any other class which could serve the purpose?


Solution

  • From project navigation select your app - > capabilities - > turn on background modes -> check Audio, AirPlay, and Picture in Picture

    This setup will add required background modes key in your info.plist

    After making this setup you can record audio in background by AVAudioRecorder.

    You can refer screenshot below,

    enter image description here