Pregunta

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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top