Unknown selected data source for Port Speaker (type: Speaker)? : <p>i am getting this message in cat log multiple times :</p>

<pre><code>[avas] AVAudioSessionPortImpl.mm:56:ValidateRequiredFields: Unknown selected data source for Port Speaker (type: Speaker)
</code></pre>

<p>i am using this code to playback background music : </p>

<pre><code>  let path = Bundle.main.path(forResource: fileName, ofType:"mp3")!
        let url = URL(fileURLWithPath: path)

        do {
                let sound = try AVAudioPlayer(contentsOf: url)
                self.player = sound
                sound.prepareToPlay()
                sound.volume = 0.05
                sound.numberOfLoops = loops
                sound.play()
        } catch {
            print("[PLAY SOUND][DELEGATE] error loading file -&gt; \(fileName)")
        }
</code></pre>

<p>i made a research and i found similar issues so i've added the audio category in viewdidload : </p>

<pre><code>  do {
            try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, mode: AVAudioSessionModeDefault)
            try AVAudioSession.sharedInstance().setActive(true)
        } catch {
            print(error)
        }
</code></pre>

<p>after i've added the above code , the background music is playing even if the phone on silent mode ! and the debugger message for <code>Unknown selected data source for Port Speaker (type: Speaker)</code> is still showing</p>
