AVAudioSessionErrorCodeCannotStartRecording when recording in the background with iOS 13

Hello.


I am working on adding support for iOS 13. Previously the app has been able to record audio for transmition while in the background when the user presses an external button, such as one from a wired headset. This is important as many users such as first responders are currently able to talk by pressing a button, rather than pulling the phone out of a pocket, unlocking it, launching the app etc.


I can't find any sort of recording in the background permission to put in the info plist. Are there any special categories or options needed in the Audio Session to permit this on iOS 13? Failing that, is there a way to launch the app when the user presses the button ( wired or bluetooth le) so the recording can start?


How does the Messages App allow recording on the notification? Inter-App Audio?


Thanks.

Replies

Hello ,



Did you find any answer for the above issue. We have reported Apple ticket, yet to get response.


Even configuring our app as Inter-App Audio also didn't help. OS is throwing below error

-CMSUtilities- CMSUtility_IsAllowedToStartRecording: CMSession: Client <private> with PID 909 is in the background and doesn't have the entitlement to start recording in the background.

No answer yet. It looks like Inter-App audio has been deprecated though the capability must still be enabled? and toying with Audio Unit Extensions is something of a nightmare. It's possibly not even worth it for the limited help it would give since if someone is already touching their phone screen they can just launch the app. A much better solution is needed. Do post the response here if you get one.

We are seeing the same issue on iOS 12.4 as well. Trying to start a recording session while in the background results in error 561145187 (!rec). This worked on all versions until 12.4. It would be great if we could get an answer from Apple if this is the new intended behavior, or a bug introduced in iOS 12.4 and the iOS 13 beta.

Thanks so much for pointing this out. It is in 12.4 and Apple has said it is a bug.

I have filed a bug report, but have not heard back yet. So you got a response from Apple indicating it is a bug?

Hi,

I have the same problem.

Did you get an answer from Apple?

Could you tell us current situation, please?

I want to know if this behavior is a specification or a bug.

Latest response; The problem is under active investigation, no resolution yet

Thank you for your information.

Please let me know if there is an update.

You really should file a bug report as well, usually helps move the process along.

You're completely right.

I submitted bug report to Apple support regarding this problem.

As additional information, the same problem occurred in iOS 13 (beta6).

Encountered this bug as well and reported it to apple. It seems that you can't start/restart capturing audio when app is in background on iOS 12.4 and iOS 13 beta. Both AVFoundation (AVCaptureSession/AVAudioRecorder) and AudioToolbox (AudioOutputUnitStart) don't work anymore. So it's impossible to resume recording after interruptions etc...

These are exactly the symptoms I'm seeing as well. iOS 12.4 and iOS13 beta (currently on public beta 5). Cannot recover from interruptions when app is backgrounded. Reported it to Apple, hopefully we'll hear back soon.

Alonso, do you have any link to where Apple says that this is a bug and not intended? Or is it in a private mail/bug correspondance?

Here is a link to my stackoverflow post that has code that displays the issue:


https://stackoverflow.com/questions/57362848/ios-12-4-avaudiorecorder-record-is-returning-false-when-app-is-in-the-background

We are also seeing this issue. I have filed a bug report, as well as a DTS ticket with Apple. In response to the DTS ticket (on Aug 6, 2019 at 4:14 PM), they said they are escalating the bug with engineering. I will reply back here if I receive any new information.