I’m using UNNotificationSound.criticalSoundNamed with the Critical Alerts entitlement. I have two separate alarms that can each be active at the same time, each scheduling its own local notification on a repeating timer.
Before switching to critical alerts, I played these with two AVAudioPlayer instances, and they overlapped fine. Now, using critical alert notifications instead, only one sound plays at a time — even when both are triggered around the same time.
Is this expected? Does iOS only ever play one critical alert sound at a time per app (or system-wide), or is there a way to get two to play simultaneously?
Code Snippet below:
Things to note: UNUserNotificationCenter is a true singleton – from what I read online…so in theory the different “sounds” or audio clips will compete to play – causing a ruckus – and this is what is actually happening.
I wanted to know if there is a work-around for this, or I should just resort to picking one sound to play at a time.
private func scheduleCriticalMotionNotification() {
let ids = Self.motionNotificationIDs
let scheduleID = nextMotionNotificationIsA ? ids[0] : ids[1]
let previousID = nextMotionNotificationIsA ? ids[1] : ids[0]
nextMotionNotificationIsA.toggle()
let center = dependencyContainer.notificationModel.notificationCenter
center?.removePendingNotificationRequests(withIdentifiers: [previousID])
center?.removeDeliveredNotifications(withIdentifiers: [previousID])
let content = UNMutableNotificationContent()
content.sound = .criticalSoundNamed(UNNotificationSoundName(rawValue: "idle_alert.wav"), withAudioVolume: alertVolume)
content.interruptionLevel = .critical
content.userInfo = ["ind_alert_kind": "one_to_one_motion"]
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 0.1, repeats: false)
let request = UNNotificationRequest(identifier: scheduleID, content: content, trigger: trigger)
center?.add(request) { error in
if let error = error {
print("❌ Error scheduling critical no-movement alert: \(error)")
}
}
}
