我想知道是否下载曲目在iPhone / iPod / iPad设备,可以使用Spotify的IOS API(CocoaLibSpotify IOS库)。 如果是这样我也需要访问他们,随时打我想要的。 我会在我的应用程序使用它们后面。
我认为,我们可以检查是否正在使用sp_track_offline_status播放曲目的脱机状态。 但我无法通过该得到的。
任何示例代码段将有很大的帮助。
简化的要求 :下载并保存Spotify的曲目到iOS设备
作为一个更新,响应iKenndac的回答,offlineStatus财产已经成为“1”,这意味着playist为本地存储同步。
SP_PLAYLIST_OFFLINE_STATUS_YES = 1,/// <播放列表同步到本地存储
意味着在播放列表中的所有曲目1.Does下载?
我不这么认为。 因为有其他规定如下:
typedef enum sp_playlist_offline_status {
SP_PLAYLIST_OFFLINE_STATUS_NO = 0, ///< Playlist is not offline enabled
SP_PLAYLIST_OFFLINE_STATUS_YES = 1, ///< Playlist is synchronized to local storage
SP_PLAYLIST_OFFLINE_STATUS_DOWNLOADING = 2, ///< This playlist is currently downloading. Only one playlist can be in this state any given time
SP_PLAYLIST_OFFLINE_STATUS_WAITING = 3, ///< Playlist is queued for download
} sp_playlist_offline_status;
我从来没有得到offlineStatus 2或3。
- 另外我offlineDownloadProgress属性始终显示我“0”。
它必须从“0”增长到“1”,如果我没有错。
代码片段:
[SPAsyncLoading waitUntilLoaded:playList
timeout:kSPAsyncLoadingDefaultTimeout
then:^(NSArray *loadedItems, NSArray *notLoadedItems) {
playList.markedForOfflinePlayback = YES;
currentPlaylist = playList;
statusTimer = [NSTimer scheduledTimerWithTimeInterval:0.3 target:self selector:@selector(checkOfflineStatus) userInfo:nil repeats:YES];
我检查了状态,如下所示:
-(void)checkOfflineStatus {
NSLog(@"playlist offline progress is: %f",currentPlaylist.offlineDownloadProgress);
NSLog(@"offline status: %d",currentPlaylist.offlineStatus);
}
输出看起来是这样的:
2012-07-06 20:34:05.891简单播放器[6571:10703]的播放列表的离线进展是:0.000000
2012-07-06 20:34:05.892简单播放器[6571:10703]脱机状态:1
2012-07-06 20:34:06.039简单播放器[6571:10703]的播放列表的离线进展是:0.000000
2012-07-06 20:34:06.039简单播放器[6571:10703]脱机状态:1
我能做些什么未来?