Using folderId reference to SPPlaylistFolder
Question
I want to be able to automatically create playlists in an specific playlist folder (also created by my app).
In order to do this, I'd like to save a reference to a created SPPlaylistFolder
and be able to access it later (i.e. when adding playlists 2 – n).
Looking at the CocoaLibSpotify docs, it seems like using the folderId
property would be a way of doing it. But the docs also state:
Important: This should only be used if you plan to directly use the C LibSpotify API. The behaviour of CocoaLibSpotify is undefined if you use the C API directly on items that have CocoaLibSpotify objects associated with them.
I'm not exactly sure how to interpret this... Just looking at the folderId
property and the methods related to it (e.g. -playlistFolderForFolderId:inContainer:
), it seems like it's possible to do what I want? Or am I missing something?
Solution
You can use the folderId
property of SPPlaylistFolder
without problems. However, when the Spotify client renames a folder, the folderId will change.
At the moment there doesn't appear to be a valid way of tracking folders through renames and moves between sessions. We're actively working on this, but in the meantime you'll have to use a best-attempt against folderId and name.