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.

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?

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.

Have a good news, Yesterday I receive the DTS response, they aware of the problem with interruptions, and a fix is planned for the future. 🙂

Hi, I'm also affected by this bug (it's still present in ios 13 beta 8), do you have any news on that ?


Thanks

We also have the same problem and have filed a bug with Apple in feedback assistant. Nr 561145187. So far they only wrote they are investigating. What bug nr do you have? Could you share the tesponse where they acknowledge it is a bug? Kind regards Jens

I've submitted a feedback nr FB7102819 , still no response.


When I'll got response I'll update this thread.


Seroiusly I hope tath they will revert to old behaviour 😟

Thanks I will update our feedback with a reference to this id @k.alonso: what response did you get? Can you share it and what id? I read that there is a security issue in 12.4 and that 12.4.1 is expected. I hope this issue will get some focus also. Kind regards Jens

@deadlock I just tested this with iOS 12.4.1 and it is still broken.

Did anyone test with 13.1 developer beta 1? I'm waiting for the public beta to get released.

It works with 13.1 beta 1. I can start recording in the background. I hope that Apple will fix also iOS 12.4.x.

Please, can share a piece of code for demonstrate that?


I Upgrade to 13.1 beta 1 and, from log i report:


XXXX is in the background and doesn't have the entitlement to start recording in the background.

I also can not start recording in the backgound with. 13.1 beta 1. I use the API "recordForDuration" of AVAudioRecorder,it also return NO in the background.Could tell me which API do you use can works in the background?

AVAudioSessionErrorCodeCannotStartRecording when recording in the background with iOS 13
 
 
Q