Group Group Group Group Group Group Group Group Group

08-user-notifications custom sound


Have any of you used custom sound in local notifications ?

iv tried UNNotificationSound(named: “soundname.extension”) and converting the audio file like apple says but my notification always go´s bace to default

let newString = titleField.text!

let content = UNMutableNotificationContent()
content.title = "!Dont Forget!"
//content.subtitle = "Glad to help..."
content.body = newString
content.sound = UNNotificationSound(named:"push.m4a")

 // content.attachments = [attachment]
content.categoryIdentifier = newCuddlePixCategoryName

let calendar = Calendar(identifier: .gregorian)
let components = calendar.dateComponents(in: .current, from: date)
let newComponents = DateComponents(calendar: calendar, timeZone: .current, month: components.month, day:, hour: components.hour, minute: components.minute)

let trigger = UNCalendarNotificationTrigger(dateMatching: newComponents, repeats: false)

let request = UNNotificationRequest(
  identifier: randomImageName, content: content, trigger: trigger)

UNUserNotificationCenter.current().add(request, withCompletionHandler:
  { (error) in
    if let error = error {
    } else {