iOS 15 issue - Audio engine graph generates a lot of "throwing -10878" messages

An audio engine graph that uses a AVAudioPlayerNode connected to the AVAudioEngine for audio playback generates a lot of "throwing -10878" messages.

Simple code to reproduce the error messages (substitute "music.mp3" with anything available):

class ViewController: UIViewController {

    var audioEngine: AVAudioEngine = AVAudioEngine()
    var player: AVAudioPlayerNode = AVAudioPlayerNode()

    override func viewDidLoad() {
        super.viewDidLoad()

        audioFilePlayback(from: "music", withExtension: "mp3")
    }
    
    
    func audioFilePlayback(from file: String, withExtension: String) {
        do {
            let audioFile = try AVAudioFile(forReading: Bundle.main.url(forResource: file, withExtension: withExtension)!)

            try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default)
            try AVAudioSession.sharedInstance().setActive(true)

            audioEngine.attach(player)
            audioEngine.connect(player, to: audioEngine.mainMixerNode, format: audioFile.processingFormat)
            player.scheduleFile(audioFile, at: AVAudioTime(hostTime: 0), completionHandler: nil)

            try audioEngine.start()
            player.play()
            
        } catch {
            print(error.localizedDescription)
        }
    }
}

Your own "AVAEMixerSample sample code" will do also.

Googling "-10878" by using https://www.osstatus.com/search/results?platform=all&framework=all&search=-10878 indicates that kAudioUnitErr_InvalidParameter has gone wrong.

Can you shed some light on this issue - what is wrong and how can it be avoided.

Thank you.

With your sample code, you can just change the connect line to the one in this stackoverflow answer: https://stackoverflow.com/questions/69414839/in-ios-15-throwing-10878-occurs-many-times-when-connecting-avaudioplayernode

HOWEVER, I am seeing the same "throwing -10878" show up when simply attaching a mixer to the audio engine:

audioEngine = AVAudioEngine()
mixer = AVAudioMixerNode()
audioEngine.attach(mixer) // <-- throwing -10878 occurs here
iOS 15 issue - Audio engine graph generates a lot of "throwing -10878" messages
 
 
Q