Hi.
I have a situation where I need to create a playlist with MusicKit and then, shortly after, access that same playlist in the cloud using the Apple Music API.
I'm creating the playlist without issue. The code looks like:
let playlist = try await MusicLibrary.shared.createPlaylist(name: caption, description: description, authorDisplayName: nil, items: items)
So far, so good.
However when I look at the resulting ID for that playlist I get something like "454485423519848175", which doesn't look much like the Id that I need to access that playlist via the Apple Music API. If I immediately query the playlist again with something like:
var playlistsRequest = MusicLibraryRequest<Playlist>.init()
playlistsRequest.filter(matching: \.name, equalTo: caption)
let playlistsResponse = try await playlistsRequest.response()
print(playlistsResponse.items.first?.id ?? "")
I get the same "454485423519848175" style of Id.
However if I run the same code a few minutes later, I'll get a cloud Id of the form "p.QZ0L3h6PM8a", which is what I need.
Current I'm having to poll the cloud version of the user's library until the playlist I've created appears, which is horrible.
Is there a better way to access the cloud playlist Id directly at the point of creation?
Thanks in advance!