有一次,我在SPTrack
中加载了多个NSArray
个。当在粗略的互联网连接上(即在加载期间连接/断开连接)时,我遇到了一些意外的(?)加载结果:跟踪包含在loadedItems
数组中,但是没有加载它们的元数据。
根据SPTrack.h
,loaded
为YES
时应加载所有数据:
/** Returns `YES` if the track has finished loading and all data is available. */
@property (nonatomic, readonly, getter=isLoaded) BOOL loaded;
我做错了什么,或者这可能是CocoaLibSpotify的问题?
我的代码:
[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
}];
控制台输出:
<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