Tuan Anh Vu
Tuan Anh Vu

Reputation: 780

Get cover art for each track with Spotify IOS SDK?

I'm having a hard time finding the solution to get the cover art for each SPTPartialTrack with the Spotify iOS SDK.

I've looked through their docs and github demo project. I can get the cover art using a separate call, parse for the image url, etc without using the SDK and I can get the album art of the current track from the currentTrackMetadata. But I am trying to get the cover art for all the tracks to display on my tableview.

Thanks for pointing me in the right direction!

Upvotes: 0

Views: 1180

Answers (2)

Nutdesigns
Nutdesigns

Reputation: 33

You will need to change from SPTPartialTrack to SPTTrack to get the cover art. You can do this using SPTRequest's requestItemFromPartialObject:withSession:callback:
Then inside the callback you can access track.album.largestCover without it being nil.

Upvotes: 0

iKenndac
iKenndac

Reputation: 18776

SPTImage *image = track.album.largestCover;

Note that for table views you might want smallestCover instead. Also be aware that in some cases, there may be no cover art (you'll get nil back in this case).

Upvotes: 4

Related Questions