Cannot read playbackStoreID property from MPMediaItem in Mac target

Running in a Mac (Catalyst) target or Apple Silicon (designed for iPad).

Just accessing the playbackStoreID from the MPMediaItem shows this error in the console: -[ITMediaItem valueForMPMediaEntityProperty:]: Unhandled MPMediaEntityProperty subscriptionStoreItemAdamID. The value returned is always “”.

This works as expected on iOS and iPadOS, returning a valid playbackStoreID.

import SwiftUI
import MediaPlayer

@main
struct PSIDDemoApp: App {
    var body: some Scene {
        WindowGroup {
            Text("playbackStoreID demo")
                .task {
                    let authResult = await MPMediaLibrary.requestAuthorization()
                    if authResult == .authorized {
                        if let item = MPMediaQuery.songs().items?.first {
                            let persistentID = item.persistentID
                            let playbackStoreID = item.playbackStoreID // <--- Here
                            print("Item \(persistentID), \(playbackStoreID)")
                        }
                    }
                }
        }
    }
}

Xcode 15.1, also tested with Xcode 15.3 beta 2.

MacOS Sonoma 14.3.1

FB13607631

Post not yet marked as solved Up vote post of gbuela Down vote post of gbuela
383 views