Obtaining a lists of artists using cocoalibspotify for iOS

房东的猫 提交于 2019-12-01 13:35:44

Take a look at the example project "Guess the Intro" included with CocoaLibSpotify. The method waitAndFillTrackPool in that project shows how to get a list of all the tracks in the user's playlists.

Once you have that list, you can do the following to get the artists from them, put them through a set to thin out duplicates, then wait until they're loaded.

NSArray *artists = [theTrackPool valueForKeyPath:@"@unionOfArrays.artists"];
NSArray *uniqueArtists = [[NSSet setWithArray:artists] allObjects];

[SPAsyncLoading waitUntilLoaded:uniqueArtists then:^(NSArray *loadedArtists) {
    // Artists are loaded!
    // Log a list of artist names...
    NSLog(@"%@", [loadedArtists valueForKey:@"name"]);
}];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!