Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top