Hello i am trying to retrieve Artist with MPMediaQuery in iOS with following code.
In My ViewDidLenter code here
oad
MPMediaQuery *query = [MPMediaQuery artistsQuery];
self.arrayOfArtist = [query collections];
And In my cellForRowAtIndexPath
cell.textLabel.text = [NSString stringWithFormat:@"%@",[[self.arrayOfArtist objectAtIndex:indexPath.row] valueForProperty:MPMediaItemPropertyArtist]];
When i check with NSLog
, my arrayOfArtist
count is about 330.
However in my UITableView
, it's only show NULL
.
Is there anything i am wronging?
you should write:
cell.textLabel.text = [NSString stringWithFormat:@"%@",[[[self.arrayOfArtist objectAtIndex:indexPath.row] representativeItem] valueForProperty:MPMediaItemPropertyArtist]];