Severe PlayAndRecord audio session bug when under some multitasking conditions

Number:rdar://13022588 Date Originated:16-Jan-2013 08:23 PM
Status:Open Resolved:
Product:iPad SDK Product Version:5,6
Classification:Serious Bug Reproducible:Always
Core Audio on iOS 5 and 6 exhibits a persistent session state bug for apps using PlayAndRecord session category and background audio, when sharing the audio system with other such apps under certain conditions.

Steps to Reproduce:
There are two currently known ways to reproduce this problem.

The first involves any two apps that (a) use the PlayAndRecord audio session category and (b) use the "audio" background mode. Apps that match this description include Loopy/Loopy HD, Multitrack DAW, Auria, BeatMaker 2, Audiobus and NLog.

1. Start one such app (App A)
2. Start another such app (App B)
3. Quit App A via the multitasking bar
4. Start App A again. App A will experience the audio session bug.

All other PlayAndRecord apps that are launched after step 4 also exhibit the bug, until all running audio apps are quit via the multitasking bar.

The second way to reproduce this problem involves 3 apps, although the features of the apps in question that cause this problem are not understood. The problem is reproduced by starting each of the apps, one after the other, in a particular sequence.

Some combinations that produce the error - which occurs in the final app - are as follows:

- Multitrack DAW, Audiobus, Loopy
- Auria, Audiobus, Loopy
- Auria, Audiobus, Multitrack DAW
- Multitrack DAW, Audiobus, Auria
- Auria, Audiobus, Multitrack DAW
- Auria, NLog, Loopy

When the bug is reproduced this way, the problem can be remedied by quitting and restarting the final app.

Expected Results:

All apps work as normal

Actual Results:

Once the bug manifests, the entire audio system for the affected apps ceases to function: Callbacks are not invoked, and no audio is produced or recorded. In addition, the bug results in a kAudioSessionIncompatibleCategory ("!cat") error when querying the kAudioSessionProperty_CurrentHardwareInputNumberChannels audio session property via AudioSessionGetProperty. 

In some conditions, the problem can be remedied by quitting the app via the multitasking bar and relaunching it. In other conditions, all active audio apps must be quit this way before the problem is fixed.


This appears to occur on all versions of iOS 6 and at least some iOS 5 versions.


This bug is causing problems with the new Audiobus inter-app audio technology, due to the resulting widespread use of multitasking.


Workaround: Not reliable

Further investigation has revealed that the workaround doesn't work reliably - there are certain circumstances under which it doesn't resolve the problem, although why is not clear.

Workaround discovered

We've just discovered a workaround that can totally fix this problem when it occurs: Simply set the audio session inactive, then active again:

AudioSessionSetActive(false); AudioSessionSetActive(true);

The problem can be detected via the kAudioSessionIncompatibleCategory error when getting the kAudioSessionProperty_CurrentHardwareInputNumberChannels audio session property, so when this happens, if one restarts the audio session as above, then retries the AudioSessionGetProperty call, the problem is resolved.

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!