"[SDKPlayback] applicationController: xpc service connection interrupted" for MPMusicPlayerController.applicationMusicPlayer iOS 16.3.1

Hi! I'm having a problem that I cannot seem to figure out. I have not made any changes to my app, yet this suddenly started happening. I think it started happening after I upgraded my phone to iOS 16.3.1, but I am not entirely sure.

Pseudocode:

// (1) initialise player
let player = MPMusicPlayerController.applicationMusicPlayer

// (2) ..later, a button is pressed and we call play()
player.play(myAlbumId)

// (3) a background timer runs, which will ensure we are playing for 30 seconds, and pausing for 60 seconds (this is a workout app):
self.timer = Timer(timeInterval: 1.0, target: self, selector: #selector(togglePauseIfNeeded), userInfo: nil, repeats: true)
RunLoop.current.add(self.timer!, forMode: .common)

// (4) Now, the problem occurs when the timer triggers  play, the second time we are playing music (ie, it works the initial time, but in that case, play was triggered by a button press (step 2)).
// So when the timer now calls player.play(), we see this error: "[SDKPlayback] applicationController: xpc service connection interrupted"

player.play() 

Interestingly, if I manually hit play just a few seconds before the timer would have called "play" (at step 4), it works fine.

Any thoughts or help on this would be highly appreciated! <3

"[SDKPlayback] applicationController: xpc service connection interrupted" for MPMusicPlayerController.applicationMusicPlayer iOS 16.3.1
 
 
Q