iOS 或 MacOS 上的 libspotify:无法检索部分 SPSession

发布于 2024-12-03 12:41:11 字数 1172 浏览 2 评论 0原文

我不知道你们中是否有人已经使用过最近可用的 Spotify API,但有一些事情困扰着我。

一旦您传递了 -(void)sessionDidLoginSuccessively:(SPSession *)aSession 回调,几乎就没有 SPSession 对象的信息了。

但对 CocoaLibSpotify 进行一些代码检查,这似乎很正常,稍后会检索数据。

问题是,这些信息似乎实际上从未被检索到。我遵循了与他们的“猜介绍”示例类似的行为,如果我这样做:

- (void)sessionDidLoginSuccessfully:(SPSession *)aSession
{
    // trying to fetch another piece of info about the user
    userTopList = [[SPToplist toplistForCurrentUserInSession:session] retain];
    [self waitForReadiness];
}

- (void)waitForReadiness
{
    // Event after 10 seconds userPlaylists is still nil
    if (![[[SPSession sharedSession] userPlaylists] isLoaded])
    {
        playlistsAttempts++;

        if (playlistsAttempts < 10) 
        {
            [self performSelector:_cmd withObject:nil afterDelay:1.0];
            return;
        }
    }
    // However, after only 1 second, userTopList is fetched
    if (userTopList.isLoaded )
        { /* do stuff */ }

}

基本上,在主会话 userPlaylists 时不到一秒后就正确设置了 userTopList一直是nil

在给定的示例中,同样的事情正在发生。

所以我开始认为这个库还没有完全存在,但我很乐意接受您的意见。

I don't know if any of you has already been playing with the recently available API for spotify but there is something that is bugging me.

Once you get passed the -(void)sessionDidLoginSuccessfully:(SPSession *)aSession callback, pretty much no information is the SPSession object.

But a bit of code inspection on the CocoaLibSpotify this seems actually normal, the data is retrieved later on.

The problem is that, it seems like of this information is actually never retrieved. I've followed a similar behavior as their "Guess the Intro" example and if I do:

- (void)sessionDidLoginSuccessfully:(SPSession *)aSession
{
    // trying to fetch another piece of info about the user
    userTopList = [[SPToplist toplistForCurrentUserInSession:session] retain];
    [self waitForReadiness];
}

- (void)waitForReadiness
{
    // Event after 10 seconds userPlaylists is still nil
    if (![[[SPSession sharedSession] userPlaylists] isLoaded])
    {
        playlistsAttempts++;

        if (playlistsAttempts < 10) 
        {
            [self performSelector:_cmd withObject:nil afterDelay:1.0];
            return;
        }
    }
    // However, after only 1 second, userTopList is fetched
    if (userTopList.isLoaded )
        { /* do stuff */ }

}

Basically the userTopList is correctly set after less than a second while the main session userPlaylists keeps being nil.

On the given example, the same thing is happening.

So I'm starting to think that the lib is just not quite there yet, but I would gladly take your inputs.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

胡渣熟男 2024-12-10 12:41:11

我遇到了同样的问题,发现以下补丁解决了我的问题:

https://github.com/spotify/cocoalibspotify/commit/2c9b85e306a8849675e5b30169481d82dbeb34f5

希望这有帮助。

-Dx

I was having the same problem and found that the following patch sorted my problem:

https://github.com/spotify/cocoalibspotify/commit/2c9b85e306a8849675e5b30169481d82dbeb34f5

Hope this helps.

-Dx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文