最近利用可能なspotifyのAPIをすでに使っている人がいるかどうかはわかりませんが、私を悩ませていることがあります。
コールバックが渡されると、オブジェクト-(void)sessionDidLoginSuccessfully:(SPSession *)aSession
となる情報はほとんどありません。SPSession
しかし、CocoaLibSpotifyでのコード検査のビットは、これは実際には正常のように見えます。データは後で取得されます。
問題は、この情報が実際には取得されていないように見えることです。私は彼らの「GuesstheIntro」の例と同様の振る舞いに従いました。
- (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 */ }
}
基本的にuserTopList
、メインセッションが継続している間、1秒以内に正しく設定さuserPlaylists
れnil
ます。
与えられた例では、同じことが起こっています。
ですから、libはまだ完全には存在しないと思い始めていますが、喜んであなたの意見を取り入れたいと思います。