Using Xcode 14.0 beta on MacOS 12.4
I have a simple app to play items in the Music library. I'm using MPMusicPlayerController.applicationQueuePlayer to play the music. Nowhere in my project do I refer to the systemMusicPlayer, nor do I have any instances of MPMusicPlayerController() alone.
Yet even if I quit the Music app, selecting a new song opens the Music app.
The code I use:
// inside a View
var mainPlayer = MPMusicPlayerController.applicationQueuePlayer
//at the end of the HStack representing a single song
.onTapGesture {
mainPlayer.setQueue(with: MPMediaItemCollection(items: [song]))
mainPlayer.prepareToPlay()
title = song.title ?? "-- No Title --"
mainPlayer.play()
}