Spotify - 从 URI 空数据获取曲目
我正在开发一个 Spotify 应用程序,并且在通过 models.Track.fromURI('uri');
检索的曲目中获取空数据如果我尝试访问曲目上的任何标准数据(例如track.album
) 我得到了对该变量的空引用。我似乎唯一能够访问的是track.uri
。奇怪的是,将曲目输出到控制台显示所有数据都存在。
这种情况只发生在两次,第一次调用 models.Track.fromURI
当应用程序加载时(重新加载应用程序可以解决问题)。当对从搜索检索到的轨道执行相同操作时(这是已弃用的 sp.core.search,因此这可能是这里的问题)。
这似乎是一个奇怪的错误,但我不能确定。
感谢您的帮助!
I'm developing a Spotify app and am getting null data in tracks I'm retrieving through models.Track.fromURI('uri');
If I try to access any standard data on the track (eg track.album
) I get a null reference to the variable. The only thing I seem to be able to access is track.uri
. Oddly, outputting the track to the console shows all data is present.
This only happens on two occasions, my first calls of models.Track.fromURI
when the app loads (reloading the app fixes the problem). And when doing the same on tracks retrieved from a search (this is the deprecated sp.core.search, so that may be the issue here).
It would appear to be an odd bug, but I can't be sure.
Thanks for the help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保在访问元数据之前等待曲目加载。
Make sure you're waiting until the track has loaded before accessing metadata.