MusicKit can't play the playlist which created by myself in iOS 16 beta 7,error:Queue descriptor was not provided

Playlist 1: created by myself, id: pl.u-BNA6rpjIRXy7Dj

https://music.apple.com/cn/playlist/i-jump-you-jump/pl.u-BNA6rpjIRXy7Dj

Playlist 2: created by Apple Music, id:pl.e1bd354664a743d1ad3e10db21118dc7

https://music.apple.com/cn/playlist/jumping-rope/pl.e1bd354664a743d1ad3e10db21118dc7

When I play list 1:

Failed to play with error: Error Domain=MPMusicPlayerControllerErrorDomain Code=1 "Queue descriptor was not provided." UserInfo={NSDebugDescription=Queue descriptor was not provided.}.

It works well on iOS 15, but has this error on iOS 16 beta6 and beta7. The list2 works well both on iOS 15 and iOS 16


  let tracks = try await loadTracks("pl.u-BNA6rpjIRXy7Dj") // not works,  pl.e1bd354664a743d1ad3e10db21118dc7 this id works

  ApplicationMusicPlayer.shared.queue = ApplicationMusicPlayer.Queue(for: tracks)

      Task {
            do {
                try await ApplicationMusicPlayer.shared.play()
            } catch {
                print("Failed  to play with error: \(error).")
            }
        }

func loadTracks(plId:String)  async throws -> MusicItemCollection<Track>  {
        let playlistRequest = MusicCatalogResourceRequest<Playlist>(matching: \.id, equalTo: MusicItemID(rawValue: plId))
        let playlistResponse = try await playlistRequest.response()
        if let playlist = playlistResponse.items.first {
            let detailedPlaylist = try await playlist.with([.tracks])
            let tmpTracks = detailedPlaylist.tracks ?? []
            return tmpTracks
        } else {
            print("Couldn't find playlist.")
            return []
        }
    }

FB: FB11426046

Accepted Reply

I tried both the playlists on iOS 16, Beta 6, and 7, and it works. Have you tried setting the playlist directly to the queue? Does that help solve the problem?

My code:


let request = MusicCatalogResourceRequest<Playlist>(matching: \.id, equalTo: "pl.u-BNA6rpjIRXy7Dj")
let response = try await request.response()
guard let playlist = response.items.first else { return }

ApplicationMusicPlayer.shared.queue = [playlist]
try await ApplicationMusicPlayer.shared.play()
  • Thanks very much, without call

    playlist.with([.tracks])

    It works!

Add a Comment

Replies

I tried both the playlists on iOS 16, Beta 6, and 7, and it works. Have you tried setting the playlist directly to the queue? Does that help solve the problem?

My code:


let request = MusicCatalogResourceRequest<Playlist>(matching: \.id, equalTo: "pl.u-BNA6rpjIRXy7Dj")
let response = try await request.response()
guard let playlist = response.items.first else { return }

ApplicationMusicPlayer.shared.queue = [playlist]
try await ApplicationMusicPlayer.shared.play()
  • Thanks very much, without call

    playlist.with([.tracks])

    It works!

Add a Comment