user2614101
user2614101

Reputation: 23

How to retrieve spotify playlist in iphone application

I have downloaded IOS Cocoa library of Spotify, which have sample project for playing songs in spotify.

I need to fetch the playlist of a Spotify particular user in an iPhone application??

Upvotes: 2

Views: 181

Answers (1)

Rahul Mane
Rahul Mane

Reputation: 1005

You can try this -

[SPAsyncLoading waitUntilLoaded:[SPSession sharedSession] timeout:kSPAsyncLoadingDefaultTimeout then:^(NSArray *loadedession, NSArray *notLoadedSession) 
{
    // The session is logged in and loaded — now wait for the userPlaylists to load.

    [SPAsyncLoading waitUntilLoaded:[SPSession sharedSession].userPlaylists timeout:kSPAsyncLoadingDefaultTimeout then:^(NSArray *loadedContainers, NSArray *notLoadedContainers) 
    {
        // User playlists are loaded — wait for playlists to load their metadata.

        NSMutableArray *playlists = [NSMutableArray array];
        [playlists addObject:[SPSession sharedSession].starredPlaylist];
        [playlists addObject:[SPSession sharedSession].inboxPlaylist];
        [playlists addObjectsFromArray:[SPSession sharedSession].userPlaylists.flattenedPlaylists];

        [SPAsyncLoading waitUntilLoaded:playlists timeout:kSPAsyncLoadingDefaultTimeout then:^(NSArray *loadedPlaylists, NSArray *notLoadedPlaylists) 
        {
            // All of our playlists have loaded their metadata — wait for all tracks to load their metadata.
            arrPlaylist = [[NSMutableArray alloc] initWithArray:loadedPlaylists];
            NSLog(@"arrPlaylist %@",arrPlaylist);
        }];
    }];
}];

Upvotes: 3

Related Questions