1

At one point, I'm loading a number of SPTracks in an NSArray. When on a sketchy internet connection (i.e. connecting/disconnecting during load), I'm experiencing some unexpected (?) loading results: tracks are included in the loadedItems array, but their metadata isn't loaded.

According to SPTrack.h, all data should be loaded when loaded is YES:

/** Returns `YES` if the track has finished loading and all data is available. */ 
@property (nonatomic, readonly, getter=isLoaded) BOOL loaded;

Am I doing something wrong, or could this be an issue with CocoaLibSpotify?


My code:

[SPAsyncLoading waitUntilLoaded:tracks timeout:kTrackLoadingTimeout then:^(NSArray *loadedItems, NSArray *notLoadedItems) {
    for (SPTrack *track in loadedItems) {
            NSLog(@"%@ loaded %i", track, track.loaded);
    }

    // ... then do stuff with the loaded tracks

}];

Console output:

<SPTrack: 0xc65c180>: Teardrop loaded 1
<SPTrack: 0xc3d86f0>: (null) loaded 1
<SPTrack: 0xc3b5730>: (null) loaded 1
<SPTrack: 0xc3ca660>: (null) loaded 1
<SPTrack: 0xc3c9c50>: (null) loaded 1
<SPTrack: 0xc3c9cf0>: (null) loaded 1
<SPTrack: 0xc3c96c0>: (null) loaded 1
<SPTrack: 0xc3c9820>: (null) loaded 1
<SPTrack: 0xc3ca1a0>: (null) loaded 1
<SPTrack: 0xc3c9020>: (null) loaded 1
<SPTrack: 0xc36fcf0>: (null) loaded 1
<SPTrack: 0xc3c8e60>: (null) loaded 1
<SPTrack: 0xc3c8c00>: (null) loaded 1
<SPTrack: 0xc3c8920>: 5 O'Clock Featuring Lily Allen & Wiz Khalifa loaded 1
<SPTrack: 0xc3c8660>: (null) loaded 1
<SPTrack: 0xc394850>: (null) loaded 1
<SPTrack: 0xc3ec040>: (null) loaded 1
<SPTrack: 0xc3896a0>: (null) loaded 1
<SPTrack: 0xc3c83e0>: (null) loaded 1
<SPTrack: 0xc3be530>: (null) loaded 1
Kristofer Sommestad
  • 3,061
  • 27
  • 39
  • 2
    Older versions of CocoaLibSpotify had a bug where the `loaded` flag would get set before metadata was applied. Otherwise, make a unit test! – iKenndac Nov 08 '12 at 10:45

0 Answers0