2016-05-20 21 views
-1

我的要求是使用Spotify iOS SDK向特定播放列表添加曲目,並確保用戶正在關注該播放列表。一般來說,除非用戶已刪除Spotify中的播放列表(實際上只是取消關注),否則添加曲目會很好,在這種情況下會添加曲目,但用戶無法再看到播放列表。使用Spotify iOS SDK關注播放列表

如果用戶沒有關注播放列表,我們可以使用SDK跟蹤播放列表嗎?

感謝

回答

0

呀只需使用SPTFollow(API documentation)。以下是Swift 3中的一個請求示例:

var req = SPTFollow.createRequestFor(followingPlaylist: URL(string: "spotify:user:USERID:playlist:PLAYLISTID"), withAccessToken: (SPTAuth.defaultInstance().session.accessToken)!, secret: false) 

SPTRequest.sharedHandler().perform(req) { (error, response, data) in 
    print("error=\(error), response=\(response), data=\(data)" 
    var results = SPTFollow.followingResult(from: data!, with: response!) 
    print("is following? \(results[0])") 
}