Re-Assigning instance of AVAudioPlayer in iOS13 leads to BAD_ACCESS runtime error

Just remove the initialisation and it will work

private var mySoundPlayer: AVAudioPlayer!

Cheers!!!


private var mySoundPlayer: AVAudioPlayer = AVAudioPlayer()

AVAudioPlayer doesn't have init() listed as a valid initializer. The reference page shows four separate initializers, all of which take at least one parameter. If you were using the line above in code prior to iOS 13.1 without crashing, you were initializing the audio player incorrectly and probably just getting lucky that it wasn't a problem.

I don't know what changed specifically with AVAudioPlayer in iOS 13.1, but the release notes show quite a few audio-related changes, and it seems likely that some change to that class introduced a dependency on something that happens at initialization time.