Search code examples
iossdkspotify

Spotify get all user's playlist


In spotify iOS SDK, get playlist code has offset = 0, and limit = 20

But If a user has 21 or more playlist.

So how can I reach them? Any idea?

I'm using

[SPTPlaylistList playlistsForUser:
                  withAccessToken:
                         callback:];

Solution

  • I have found my answer on spotify Api Reference

    // Getting the first two pages of a playlists for a user

    NSURLRequest*playlistrequest = [SPTPlaylistList createRequestForGettingPlaylistsForUser:@"possan" withAccessToken:accessToken error:nil]; [[SPTRequest sharedHandler] performRequest:playlistrequest callback:^(NSError *error, NSURLResponse *response, NSData *data) {
    if (error != nil) { Handle error }
    SPTPlaylistList *playlists = [SPTPlaylistList playlistListFromData:data withResponse:response error:nil];
    NSLog(@"Got possan's playlists, first page: %@", playlists);
    NSURLRequest *playlistrequest2 = [playlists createRequestForNextPageWithAccessToken:accessToken error:nil];
    [[SPTRequest sharedHandler] performRequest:playlistrequest2 callback:^(NSError *error2, NSURLResponse *response2, NSData *data2) {
        if (error2 != nil) { Handle error }
        SPTPlaylistList *playlists2 = [SPTPlaylistList playlistListFromData:data2 withResponse:response2 error:nil];
        NSLog(@"Got possan's playlists, second page: %@", playlists2);
    }];}];