PlaySound below crashes with this error: AddInstanceForFactory: No factory registered for id

Problem = PlaySound below crashes with this error:

AddInstanceForFactory: No factory registered for id

Setting a breakpoint before the guard let url block = NO error.

Setting a breakpoint after the guard let url block = error!!, coupled with a horrible static sound happening. Note that if I set NO breakpoints, the correct sound happens but with the above error.

What am I missing?

Within my SKScene Class:

func controllerInputDetected(gamepad: GCExtendedGamepad,
                             element: GCControllerElement,
                             index: Int) {

    // rightShoulder
    if (gamepad.rightShoulder == element)
    {
        if (gamepad.rightShoulder.value != 0)
        {
            startGame()
       }
    }

}

As shown above, I call the following function by pressing a shoulder button on my Gamepad:

func startGame() {
    
    PlaySound(theSoundName: "roar")
    
}

func PlaySound(theSoundName: String) {
    
        guard let url = Bundle.main.url(forResource: "audio/" + theSoundName, withExtension: "mp3") else {
            print("sound not found")
            return
        }
    
        do {
            try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default)
            try AVAudioSession.sharedInstance().setActive(true)

            itsSoundPlayer = try AVAudioPlayer(contentsOf: url)

            if theSoundName == "roar" {
                itsSoundPlayer?.numberOfLoops = -1   // forever
            }
            itsSoundPlayer!.play()
        }
        catch let error as NSError {
            print("error: \(error.localizedDescription)")
        }

}

Again, what am I missing?

FWIW the above iOS error changes for tvOS =

<NSError: 0x600002cdf540; domain: FBSSceneSnapshotErrorDomain; code: 4; reason: "an unrelated condition or state was not satisfied"

PlaySound below crashes with this error: AddInstanceForFactory: No factory registered for id
 
 
Q