我正在从youtube API v3获得JSON响应https://www.googleapis.com/youtube/v3/channels?part=statistics&id并接收JSON响应作为
{
etag = ""rFqCJSkEICLP3Hq6a4AADI7kf48/2zirKmd0WgUqY0RzlyD4hlACeWM"";
items = (
{
etag = ""rFqCJSkEICLP3Hq6a4AADI7kf48/u4TmQ5XfIQQg6y6u4Od2yULCVlc"";
id = "HCcrj0EHvn_Y8";
kind = "youtube#channel";
statistics = {
commentCount = 0;
subscriberCount = 21694;
videoCount = 124582;
viewCount = 0;
};
},
{
etag = ""rFqCJSkEICLP3Hq6a4AADI7kf48/2p4_mjrZLfhO6bDvH-RgAykNQr8"";
id = UCX2v47KsDKqajrEYFV7GbBg;
kind = "youtube#channel";
statistics = {
commentCount = 6460;
subscriberCount = 494656;
videoCount = 33;
viewCount = 713607227;
};
}
}
当我试图显示时
cell.viewsChannel.text=[[_statistics valueForKeyPath:@"statistics.videoCount"] objectAtIndex:indexPath.row];
该值不会显示在表视图中。我试图将输出格式化为unsigned long,int,但没有显示正确的值。请帮忙提前感谢
我认为您需要将项添加到valueForKeyPath
cell.viewsChannel.text=[[_statistics valueForKeyPath:@"item.statistics.videoCount"] objectAtIndex:indexPath.row];