Reputation: 31
Hi I'm trying to extract the artists from the the user starred songs. I understand that starredListForUserInSession returns a PlaylistSnapshot. That has a firstTrackPage attribute that's a SPTListPage.
In my test when printing out the SPTListPage, it says the list has 8 items. When I try to get the items in the ListPage with ListPage.items it returning nil. I'm not sure what's wrong. Am I calling the wrong property?
func retrieveStarred() -> Void {
SPTRequest.starredListForUserInSession(self.session, callback: { (error:NSError!, starred: AnyObject!) -> Void in
if error != nil {
println("error retrieving starred playlist")
} else {
self.starred = starred as SPTPlaylistSnapshot
self.scrapePlaylist(self.starred)
}
})
}
func scrapePlaylist(playlist: SPTPlaylistSnapshot) -> Void {
println(playlist);
var firstTracks = playlist.firstTrackPage
println(firstTracks)
println(firstTracks.hasNextPage)
var songs = firstTracks as SPTListPage
println(songs.items)
for song in songs.items {
var track = song as SPTPartialTrack
for artist in track.artists {
updateSongsCount(artist as SPTPartialArtist)
}
}
}
Upvotes: 3
Views: 313
Reputation: 95
I think this page (github.com/spotify/ios-sdk/issues/377) was setup by the same person that asked this question and he did finally figure it out in the comments on that page. I thought I'd paste it here for anyone else with the same issue. The comment on that page worked for me too:
"Ok - Got it fixed
To complete the set up of your build environment, switch from the Info tab to the Build Settings tab and find the Other Linker Flags build setting (you can search for it using the search field at the top of the settings list). If you don’t see it you might need click on ‘All’ to show all build settings.
Add the value -ObjC to this setting." -github.com/spotify/ios-sdk/issues/377
Upvotes: 1
Reputation: 46
Try adding the linker flag "-all_load" to Other Linker Flags in your Project File.
Upvotes: 0