@OOPer, your solution doesn't work for me.
This is now showing up on my console, but not causing a crash. The audio (mp3 file) still plays as expected. I use AVAudioPlayer from AVFoundation in my code on macOS Big Sur, XCode 12.3, Swift 5.3. I building a macOS app, not iOS.
I declare my player as var player:AVAudioPlayer? (I had it also as AVAudioPlayer!) and both produce the same console message above. Like I wrote above, the audio still plays, but I would like to get this resolved so the message no longer appears.
I stepped through my code and the error is appearing immediately upon calling player?.prepareToPlay() method.
EDIT: Subsequent calls to this method does not reproduce the error in the console. It is only happening upon the initial call to this method. If I play a subsequent mp3 file it doesn't repappear.
if player?.prepareToPlay() != nil {
Thanks to anyone who can suggest how to resolve this.
Topic:
Programming Languages
SubTopic:
Swift
Tags: