0

我从 youtube API v3 获取https://www.googleapis.com/youtube/v3/channels?part=statistics&id的 JSON 响应并接收 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 但未显示正确的值。请帮助提前谢谢

4

1 回答 1

0

我认为您需要将项目添加到 valueForKeyPath

cell.viewsChannel.text=[[_statistics valueForKeyPath:@"item.statistics.videoCount"] objectAtIndex:indexPath.row];
于 2013-07-20T21:02:32.700 回答