I'm making a music player app that can access and play music and playlists that come from Apple Music and the iOS music library, and I want to be able to save and reload the user's song queue across app launches. If a song is locally stored on a phone, it's easy enough to save its MPMediaItem.persistentID and then load the item back up using a predicate like this:
let predicate = MPMediaPropertyPredicate(value: savedLocalID, forProperty: MPMediaItemPropertyPersistentID);
let songQuery = MPMediaQuery.init(filterPredicates: [predicate]);
However, with songs that come from playlists saved from Apple music, their MPMediaItem.persistentID isn't preserved across app launches and doesn't work to load them as MPMediaItems. I was hoping that MPMediaItem.playbackStoreID could be used in a similar way with MPMediaQuery, but when I try to make a predicate using it with MPMediaItemPropertyPlaybackStoreID I get the error "MPMediaPropertyPredicate cannot filter using the playbackStoreID property." Any ideas how to get an MPMediaItem from a saved MPMediaItem.playbackStoreID, or another property I'm missing that works for non-local Apple Music files? Thanks!