AVAudioPlayer doesn't work on iOS 13 Simulator (Xcode 12.4)

Code Block language
import UIKit
import AVFoundation
class ViewController: UIViewController {
   
  var audio: AVAudioPlayer?
  override func viewDidLoad() {
    super.viewDidLoad()
     
    do {
       
let path = Bundle.main.path(forResource: "music.mp3", ofType:nil)!
      let url = URL(fileURLWithPath: path)
      audio = try AVAudioPlayer(contentsOf: url)
      audio?.play()
       
    } catch {
      print("error: \(error)")
    }
    
  }
}


It works on iOS 14 Simulator.

Errors: HALB_IOBufferManager_Client::GetIOBuffer: the stream index is out of range

It seems problem has already been reported several times:
https://developer.apple.com/forums/thread/667921
https://developer.apple.com/forums/thread/652852
For others, it worked in iOS13 and no more on 14 ß
https://developer.apple.com/forums/thread/650741

Could you test on an iOS 13 device ?
If it works, I fear you'll have to avoid iOS13 simulator for this app…

I don't have a device with ios 13 unfortunately.. Hope it will work anyway. This is a problem of xCode 12 and Big Sur because the code is right though
AVAudioPlayer doesn't work on iOS 13 Simulator (Xcode 12.4)
 
 
Q