iOS 15.1 - Notification sound is not playing when only .sound option

We have an issue when we tried to fire only the sound in the push notification in iOS 15.

Sound does not play when UNNotificationPresentationOptions is only set as sound. [.sound] (see snippet code attached)

It seems iOS 15 silence this. It was working before in iOS 14 but stopped working for iOS 15.

The following StackOverflow's URLs recommend playing a sound with AudioServicesPlaySystemSound.

https://stackoverflow.com/questions/69023854/ios-15-notification-sounds-are-not-playing-for-foreground-notifications

https://stackoverflow.com/questions/69277080/before-ios-15-i-was-able-to-send-sound-only-local-notification-now-i-have-to-s

Any tips/recommendations on how to resolve this? Does anyone know if Apple does not allow this anymore?

func taskNotificationCenter(_ center: TaskNotificationCenterType,
               willPresent notification: UNNotificationType,
               withCompletionHandler completionHandler:
                @escaping (UNNotificationPresentationOptions) -> Void) {  
  completionHandler([.sound]) // does not work
//completionHandler([.sound, .alert, .badge]) // works
}
Answered by lucianoperez in 721588022

This is fixed on iOS 16 but this does not work on any of the iOS 15. I have tried 15.0 to 15.6 and none of the versions works.

I'm running into the same thing but I don't want to show the alert.

I found this but .list isn't doing the trick for me: https://stackoverflow.com/questions/69023854/ios-15-notification-sounds-are-not-playing-for-foreground-notifications

Accepted Answer

This is fixed on iOS 16 but this does not work on any of the iOS 15. I have tried 15.0 to 15.6 and none of the versions works.

iOS 15.1 - Notification sound is not playing when only .sound option
 
 
Q