1

I am using cocoaLibSpotify to get the user playlists and relative containers. I managed successfully the user connection but I am struggling to get the user playlists and relative folders/containers.
Also attempt to create a playlist have inconsistence results (only occasionally I see the playlist appearing on Spotify).

This the attempt on retrieving the user playlist:

    //self.session = [SPSession sharedSession];

    SPPlaylistContainer *container = [self.session userPlaylists]; // correctly initialised
    NSArray *allPlaylists = container.playlists; // always Empty!

This my attempt on creating the playlist:

[SPSession dispatchToLibSpotifyThread:^{
       // self.mpmePlaylistFolder = SPPlaylistFolder;
        sp_playlist *spPlaylist = sp_playlistcontainer_add_new_playlist(self.mpmePlaylistFolder.parentContainer.container, name.UTF8String);
        playlist = [SPPlaylist playlistWithPlaylistStruct:spPlaylist inSession:self.session];
        _playlists = nil;
    } waitUntilDone:YES];
cescofry
  • 3,706
  • 3
  • 26
  • 22

1 Answers1

0

To retrieve the user playlists, you need to use SPAsyncLoading to wait until the user playlists container is loaded.

To create a playlist, just use [SPPlaylistContainer -createPlaylistWithName:].

There are examples on how to do this in the sample projects provided with CocoaLibSpotify.

iKenndac
  • 18,730
  • 3
  • 35
  • 51