Spotify get all user's playlist

1.1k views Asked by At

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?

Im using

[SPTPlaylistList playlistsForUser:
                  withAccessToken:
                         callback:];
1

There are 1 answers

2
Mustafa On BEST ANSWER

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);
}];}];