In the sample project, Guess the Intro, there is a method called waitAndFillTrackPool that gets all the tracks from a user's playlists. Inside this method, a call is made using SPAsyncLoading to get all the tracks' metadata.
[SPAsyncLoading waitUntilLoaded:tracks timeout:kSPAsyncLoadingDefaultTimeout then:^(NSArray *loadedTracks, NSArray *notLoadedTracks) {
// All of our tracks have loaded their metadata. Hooray!
NSLog(@"[%@ %@]: %@ of %@ tracks loaded.", NSStringFromClass([self class]), NSStringFromSelector(_cmd),[NSNumber numberWithInteger:loadedTracks.count], [NSNumber numberWithInteger:loadedTracks.count + notLoadedTracks.count]);
On success, as the comment says, the metadata for all tracks should be loaded. However, I am unable to get track.album.cover.image (it returns null). All other metadata seems to be there.
To test what is going on I added this after the metadata should be loaded:
SPTrack *test = [theTrackPool objectAtIndex:0];
NSLog(@"track: %@ , is loaded: %s, image loaded: %s",test.name,test.loaded ? "true" : "false", test.album.cover.loaded ? "true" : "false");
Which logs:
track: Howlin' For You , is loaded: true, image loaded: false
If the metadata should be loaded, shouldn't the album cover also be available?
Just to clarify, I can get this particular track's album art if use the playback manager and key-value observing. However, I do experience the similar first value nil, second value correct as in Downloading cover art URL from Spotify and key-value observing. Maybe this is a similar bug? If the album art does need to be rechecked, how do I setup an observer to get the album art from an array of tracks?
Thanks for your time!