ios - spotify playlistsForUserWithSession call returns invalid array -
when calling playlistsforuserwithsession on latest beta ios sdk spotify, appears proper array, can 'po pl.items' , shows list of playlists in debug window. however, if try pl.items.count "member reference base type 'void *' not structure or union" , if try pl.items[0] returns error "subscript of pointer incomplete type 'void'" here's code. thanks:
sptauth *auth = [sptauth defaultinstance]; //get list of current playlists [sptplaylistlist playlistsforuserwithsession:auth.session callback:^(nserror *error, id object) { if (!error) { nsurl *playlisturl = nil; pl= object; //at point, pl object isn't playing nice if(pl != nil && pl.items != nil && pl.items.count > 0) { playlisturl = [pl.items[0] uri]; } else { //snipped code } nsstring * theresult = [playlisturl absolutestring]; //snipped code } else { nslog(@"problem spotify media picker..."); } } }];
in implementation, use tracksforplayback method delegate spttrackprovider
a code snippet
@property (strong, nonatomic) sptplaylistlist *spotifylists; sptpartialplaylist *partialplaylist = [[_spotifylists tracksforplayback] objectatindex:indexpath.row]; uiimage *placeholder = [uiimage imagenamed:@"placeholder.jpg"]; [cell.profileimageview setimagewithurl:partialplaylist.smallestimage.imageurl placeholderimage:placeholder]; cell.titlelabel.text = [nsstring stringwithformat:@"%@", partialplaylist.name]; cell.auxilarylabel.text = [@(partialplaylist.trackcount) stringvalue]; not quite sure when use items property though
Comments
Post a Comment