I have an app that uses CoreBluetooth background modes. When a certain event happens I need to play an alarm sound. Everything works fine in the foreground and
Maybe you should make your app's audio session higher than others.
Besides the process to setting background mode, you must set AudioSession correctly.
Sometimes just doing this is not enough
[[AVAudioSession sharedInstance] setActive:YES error:&activationErr];
because in Help document there is a discussion about setActive
Discussion
If another active audio session has higher priority than yours (for example, a phone call), and neither audio session allows mixing, attempting to activate your audio session fails. Deactivating your session will fail if any associated audio objects (such as queues, converters, players, or recorders) are currently running.
So, setActive:withOptions:error: is needed. Just like this
[audioSession setCategory :AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:&error]
That is you must make your app's audio session higher than others.