I have successfully recorded and played the voice for the local notification sound and it also get played on calling that function.
But problem is when i give sound's link to the notification sound property, it do not work.
notification.sound = UNNotificationSound.init(named: "martian-gun copy.m4a")
Above code works perfectly. But when i gave it URL(in the form of string) it do not play the exact sound. Code not working is follows:
let fm = FileManager.default
let docsurl = try! fm.url(for:.documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
let myurl = docsurl.appendingPathComponent("sound.m4a")
notification.sound = UNNotificationSound.init(named: myurl)
myurl have same path at which voice play on playButton. Finally question is how to set notification custom sound from the sound URL?