ios - Get Spotify Track artwork on UITableView -
i trying artworks or album covers using spotify api. using:
nsstring *url = @"http://ws.spotify.com/search/1/track.json"; nsmutabledictionary *params = [[nsmutabledictionary alloc] initwithobjectsandkeys: ([utils isemptystring:_searchbar.text] ? @"music" : _searchbar.text), @"q", nil]; [self sendrequestwith:url params:params method:requestmethodget success:^(afhttprequestoperation *operation, id response, nsdictionary *userdata) { nsdictionary *result = (nsdictionary *)response; if(result){ [_tracklist removeallobjects]; nsarray *tracks = [utils getdictionaryvalue:result by:@[@"tracks"]]; (nsdictionary *trackdata in tracks) { wptrack *track = [[wptrack alloc] initwithspotifyjson:trackdata]; [_tracklist addobject:track]; } [listviewcontroller updatewithobjects:_tracklist]; } } failure:^(afhttprequestoperation *operation, nserror *error, nsdictionary *userdata) { } userdata:nil];
the current method getting doesn't seem return thumbnail of track. returns "href" of track can use search track's image https://embed.spotify.com/oembed/?url=spotify:track:6bc5scnuva3h76t9nvpgih. however, might request slow loading on uitableview. there better way process together?
it common practice not include rich media content in api response client have wait until has been sent can take long time. speed process should parser information gathered , display user while have asynchronously operation using block retrieve image , display it.
Comments
Post a Comment