MP3 works on simulator but not after I upload the build

Hello Everyone,

I am having a problem here with my app. I developed a timer that play a sound .mp3 and the sound play every time that the timer start and finish.

Everything works very well in the simulator but not on the devices after I distribute the build and install using the testflight.

I saw the build content and the file is inside. However, I have no idea what I am doing wrong (if it is some option that i forgot to check or some problem in my code). Please, somebody can help me?

Here is the func with the path. (I inserted the sound on the root) in the same place that we can find the Contentview.

func playFinishSound() {

guard let url = Bundle.main.url(forResource: "finish_sound", withExtension: "mp3") else { return }

do {

player = try AVAudioPlayer(contentsOf: url)

player?.play()

} catch {

print("Error playing finish sound")

}

}

}

Thank you very much for your help. I appreciate.

Antonio

I would be sure to validate the capitalization of the file and path. Macos tends to come using a case insensitive file system where ios is case sensitive.

Hi @jlilest ,

I tried to change the filename for a more simple one "sound.mp3" and the behavior is the same, sound on the simulator and no sound on the device. Do you have any other idea?

Thanks for your help!

MP3 works on simulator but not after I upload the build
 
 
Q