AVAudioPlayer EXC_BAD_ACCESS

For me it was because I wasn't calling the one of the designated initialisers. I was instantiating it with AVAudioPlayer() instead of the designated initialisers which are public init(contentsOfURL url: NSURL) throws and public init(data: NSData) throws


As of iOS 13, make sure you are removing the initialization on AVAudioPlayer before asigning it with AVAudioPlayer(contentsOf: URL(...))

i.e. change var audioPlayer = AudioPlayer() to var audioPlayer: AVAudioPlayer!


I guess you have to use prepareToPlay method to find whether it has loaded or not.