我正在构建一个应用程序,它在首次加载时请求多个专辑和播放列表的数据。
对于其中的每一个,我都调用
models.Album.fromURI(uri, function(album){});
或 。
models.Playlist.fromURI(uri, function(playlist){});
大多数情况下,这些工作正常,我可以从回调函数中从专辑或播放列表中获取信息,但是,偶尔(5%的时间)回调函数永远不会被调用我的应用程序显示的数据集不完整。
我想知道是否有其他人遇到过类似的问题或对可能导致该问题的原因有任何见解(API 错误、请求速率限制等)
I'm building an app which requests data for several albums and playlists when it first loads.
For each of these I am calling either
models.Album.fromURI(uri, function(album){});
or
models.Playlist.fromURI(uri, function(playlist){});
For the majority of the time these work fine and I can get info from the album or playlist from within the callback function, however, occasionally (5% of the time) the callback function is never called and I'm left with an incomplete data set for my app to display.
I'm wondering if anyone else has encountered similar problems or has any insight into what might be causing it (API bugs, request rate limiting, etc)
发布评论
评论(1)
不幸的是,Spotify Apps API 0.X 缺少错误回调函数,当调用
models.Album.fromURI
或models.Playlist.fromURI
时出现问题时,可以调用该函数。通过使用 承诺:
Unfortunately, the Spotify Apps API 0.X lacked an error callback function that could be called when something went wrong when calling
models.Album.fromURI
ormodels.Playlist.fromURI
.This has been greatly improved in the Spotify Apps API 1.x through the use of Promises: