Reputation: 65
I'm trying to get the user's Saved Tracks using the following code snippet:
func getYourMusicLibrary() {
let accessToken = SPTAuth.defaultInstance().session.accessToken
let request: URLRequest = try! SPTYourMusic.createRequestForCurrentUsersSavedTracks(withAccessToken: accessToken)
SPTRequest.sharedHandler().perform(request) { (error, response, data) in
if error == nil {
let listPage = try! SPTListPage(from: data, with: response, expectingPartialChildren: false, rootObjectKey: nil)
let items = listPage.items
The listPage.items is always nil. I also tried to set rootObjectKey of the SPTListPage constructor to the expected object type result SPTSavedTrack and expectingPartialChildren to true. Also listPage.totalListLength has a number of tracks that is consistent with the number of tracks I have in my Songs list in My Music.
Any ideas of what I might be doing wrong here?
Upvotes: 1
Views: 93
Reputation: 65
To fix this issue I had to add -ObjC in "Other Linked Flags" in the Build Settings of the project.
Upvotes: 1