Offline playlists using CocoaLibSpotify

拈花ヽ惹草 提交于 2019-12-08 13:01:57

问题


I am using CocoaLibSpotify in an iOS application. When I set markedForOfflinePlayback to YES on an instance of SPPlaylist the offlineStatus almost immediately changes to SP_PLAYLIST_OFFLINE_STATUS_YES for the playlist and the tracks in the playlist. However, the offlineDownloadProgress is 0.0 all the time.

The tracks have clearly not been cached. First and foremost, it would take much longer to cache them. Secondly, when I put my device in airplane mode and try to play one of the tracks marked as offline, no audio is played.

Does anyone have an idea what I might be doing wrong?


回答1:


The most common cause for this is not shutting down CocoaLibSpotify properly when the application goes into the background - this can cause the cache to end up in an odd state that will cause offline syncing to fail. To avoid this, when your app goes into the background, you should start a background task, begin the logout process then end the task when logout is complete. The Empty CocoaLibSpotify Project sample project demos this.

Also, make sure you're updated to the latest version of CocoaLibSpotify - it contains an update to the underlying libSpotify library that makes offline syncing quite a lot more reliable. You still need to perform the proper backgrounding technique, though.

Finally, have a look at the Offline Syncing Mac sample project. It lets you see the offlining process in a visual way.



来源:https://stackoverflow.com/questions/19143882/offline-playlists-using-cocoalibspotify

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!