![](/img/trans.png)
[英]Using iOS and Swift, how do I get the list of songs in a playlist in their natural order
[英]How to get the list of songs using Spotify in Swift3 iOS?
我正在使用Swift3语言开发音乐应用。 用户将在其中具有弹出选项,以使用“音乐库和Spotify”显示歌曲列表。 我可以将音乐库中的歌曲列表显示到我的表视图中。 现在,我必须从Spotify获取播放列表。 所以,我添加了应用程序在accounts.spotify.com
,我可以使用一个播放歌曲一个SPTAudioStreamingController.sharedInstance().metadata
,但全歌曲列表不来。
我遵循以下链接: https : //github.com/Sethmr/SpotifyInSwift和https://medium.com/@elonrubin/ios-spotify-sdk-swift-3-0-tutorial-b629af4b889d和https:// developer。 spotify.com/technologies/spotify-ios-sdk/tutorial/
问题是如何获取Spotify歌曲列表。 如果有人有什么想法,请建议我。 谢谢!
还有一个试试这里
还有更多控件
取得相簿:
_ = Spartan.getAlbum(id: albumId, market: .us, success: { (album) in
// Do something with the album
}, failure: { (error) in
print(error)
})
获得几首曲目:
_ = Spartan.getTracks(ids: trackIds, market: .us, success: { (tracks) in
// Do something with the tracks
}, failure: { (error) in
print(error)
})
尝试一下,可能会帮助您https://github.com/Daltron/Spartan
SPTPlaylistList.playlists(forUser: session.canonicalUsername, withAccessToken: session.accessToken, callback: { (error, response) in
self.activityIndicator.stopAnimating()
if let listPage = response as? SPTPlaylistList, let playlists = listPage.items as? [SPTPartialPlaylist] {
self.playlists = playlists // or however you want to parse these
self.tableView.reloadData()
if listPage.hasNextPage {
self.getNextPlaylistPage(currentPage: listPage)
}
}
})
更新:
也请参考此示例代码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.