Reputation: 5252
I have recently been using the new Apple MusicKit functionality.
I've got a Developer Token
and Music-User-Token
and I can run the test code provided by Apple.
I want to try and do a few more things but the documentation doesn't seem to cover it.
From what I can tell (at the moment) the User Token is only used to edit things like ratings of albums, songs etc
What I'd love to do is create a playlist (via this API rather than the native Objective-C/Swift) code.
Using the native code, the playlist ID is a GUID but this ID doesn't seem to be relevant to the Apple APIs ID for a playlist (formatted pl.u-[uniquereference]
)
I'd also like to retrieve a list of my playlists.
Has anyone done this? Is it even possible?
Upvotes: 2
Views: 3578
Reputation: 163
You can download the Apple Music Sample Code here, and take a look function createPlaylistIfNeeded() in MediaLibraryManager.swift. It does create a playlist.
Base on my understanding you can create and retrieve the playlist by using
MPMediaLibrary.getPlaylist(with:creationMetadata:completionHandler:)
However, if you go to check this function's definition on Apple Developer Document
getPlaylist(with:creationMetadata:completionHandler:)
Retrieves an app maintained existing playlist or creates a new playlist when no playlist exists.
So, I think you can not retrieve users' playlist unless it is created in your app.
Btw, Would you mind to share how you done with the JWT? I checked the website that the Apple provided JWT Website. But the swift library JWT it recommended on the site, has not yet supported ES256. So I had to use a python library to generate one and hardcode in the code for testing.
Please let me know if you have solved it. Thanks
Upvotes: 2