According to Apple\'s documentation, sound file in the ~/Library/Sounds will be search by system when trying to play a sound. How do I add a sound file to this folder?
I
the link you have is for Mac! the correct document for iOS should be here
in summary, you can just add the sound file to your project as a nonlocalized resource of the app bundle.
I struggled with this as well. You have to create the Library/Sounds directory programmatically and move your custom sound into it.
let soundsDirectoryURL = fileManager.urls(for: .libraryDirectory, in: .userDomainMask).first!.appendingPathComponent("Sounds")
//attempt to create the folder
do {
try fileManager.createDirectory(atPath: soundsDirectoryURL.path,
withIntermediateDirectories: true, attributes: nil)
} catch let error as NSError {
print("Error: \(error.localizedDescription)")
}
I had the exact same problem at work. I would suggest -