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
}
Add a Comment