I found a crash issue in AVAudioPlayer
with iOS 13.1.
Here Is Solution
Why My AVAudioPlayer
crash? because
I initialise AVAudioPlayer
like
var wrongMusicPlayer: AVAudioPlayer = AVAudioPlayer()
and then i try to reassign wrongMusicPlayer
as below
wrongMusicPlayer = try AVAudioPlayer(contentsOf: wrongURL)
And my app get crash.
Solution
If you initialise your AVAudioPlayer
like var wrongMusicPlayer: AVAudioPlayer = AVAudioPlayer()
OR wrongMusicPlayer = AVAudioPlayer()
in any method then please remove it and just Declare like var wrongMusicPlayer: AVAudioPlayer!
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…