我已经下载了Spotify的IOS Cocoa库,它有一个用于在spotify中播放歌曲的示例项目。
我需要在iPhone应用程序中获取Spotify特定用户的播放列表吗?
答案 0 :(得分:4)
你可以试试这个 -
[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);
}];
}];
}];