Below is my code. It has always worked fine. Now in iOS 15 it no longer plays the custom notification sound, it plays the default tri-tone sound when the notification fires. Everything else is working fine.
let notificationContent = UNMutableNotificationContent()
let customNotificationSound = defaults.string(forKey: "notificationSound")
notificationContent.title = "Notification Title"
notificationContent.subtitle = "Notification Subtitle"
notificationContent.body = "Notification Body"
notificationContent.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: "\(customNotificationSound ?? "default").m4a"))
notificationtriggerDate = Calendar.current.dateComponents([.day,.month,.year,.hour,.minute,.second,], from: notificationTriggerTime)
let notificationtrigger = UNCalendarNotificationTrigger(dateMatching: notificationtriggerDate, repeats: false)
let notificationrequest = UNNotificationRequest(identifier: UUID().uuidString, content: notificationContent, trigger: notificationtrigger)
center.add(notificationrequest)
{ (error) in
if error != nil {
print(error as Any)
}
}
}