Dan.code
Dan.code

Reputation: 441

Custom sound for Local Notifications not working

I know this question comes up a lot. I've read through a lot of questions on here about this topic. But I've followed instruction and it's still not working. Here's the input for the sound

Content.sound = UNNotificationSound(named: "Sound.caf")

and the Sound.caf file is located in the main bundle.

The format of the Sound.caf file is IMA 4:1, 2 channels, 44100 Hz. The sound is only 29 seconds long. I'm sure all the above is the right criteria for a custom sound in local notification. However, I still get the default sound instead of my custom sound.

Upvotes: 1

Views: 650

Answers (1)

Return Zero
Return Zero

Reputation: 434

Go to target > Build Phases > Copy Bundle Resource > Click + . add Sound.caf to copy Bundle Resource . hopefully it will works.

enter image description here

Upvotes: 1

Related Questions