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获取歌曲列表?
基础教程推荐
- iOS4 创建后台定时器 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
