0
這裏挑一首歌是我試過到目前爲止: - (IBAction爲)getPlaylistsButtonTapped:(ID)發送{獲取用戶的播放列表,並能夠從中
NSURLRequest *playlistrequest = [SPTPlaylistList createRequestForGettingPlaylistsForUser:@"charleshyowonkang" withAccessToken:_accessToken error:nil]; [[SPTRequest sharedHandler] performRequest:playlistrequest callback:^(NSError *error, NSURLResponse *response, NSData *data) {
if (error != nil) { NSLog(@"error");
}
SPTPlaylistList *playlists = [SPTPlaylistList playlistListFromData:data withResponse:response error:nil];
NSLog(@"Got possan's playlists, first page: %@", playlists);
NSURLRequest *playlistrequest2 = [playlists createRequestForNextPageWithAccessToken:_accessToken error:nil];
[[SPTRequest sharedHandler] performRequest:playlistrequest2 callback:^(NSError *error2, NSURLResponse *response2, NSData *data2) {
if (error2 != nil) {
NSLog(@"error2");
}
SPTPlaylistList *playlists2 = [SPTPlaylistList playlistListFromData:data2 withResponse:response2 error:nil];
NSLog(@"Got possan's playlists, second page: %@", playlists2);
}];}];
}
所有教程/ stackoverflow的帖子我google了是爲web項目,但我想在iOS中這樣做。
我才真正需要做的API請求兩次。
1)當用戶與他們的帳戶的Spotify
2)當用戶按下登錄「聲音」按鈕,它拉他們的播放列表/軌道。
任何iOS的幫助將是非常有益的。