How to get the list of songs using Spotify in Swift3 iOS?(如何在Swift3 iOS中使用Spotify获取歌曲列表?)
问题描述
我正在开发一个使用Swift3语言的音乐应用程序。在那里,用户将有弹出选项,以显示使用音乐库和Spotify的歌曲列表。我可以将音乐库中的歌曲列表显示到我的表视图中。现在,我必须从Spotify获取播放列表。因此,我在accounts.spotify.com
中添加了App,我可以使用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歌曲列表。如果谁有什么想法,请推荐我。谢谢!
推荐答案
还有一个可以尝试here
还有更多控件
获取专辑:
_ = 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
还要查看this answer(Samantha's)
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)
}
}
})
更新:
参考sample code另请参阅
这篇关于如何在Swift3 iOS中使用Spotify获取歌曲列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在Swift3 iOS中使用Spotify获取歌曲列表?


- android 4中的android RadioButton问题 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01