Ios Json数据崩溃'-[\uu NSCFString objectForKey:]:发送到实例0x10a860840的选择器无法识别

Ios Json数据崩溃'-[\uu NSCFString objectForKey:]:发送到实例0x10a860840的选择器无法识别,ios,json,uitableview,Ios,Json,Uitableview,这是我的代码,我想在UITableview上显示Json数据。我的应用程序因以下原因而崩溃'-[\u NSCFString objectForKey:]:无法识别的选择器已发送到实例0x10a860840。我是Json新手 - (void)viewDidLoad { [super viewDidLoad]; NSError *error; NSString *url_string = [NSString stringWithFormat: @"http://api.ge

这是我的代码,我想在UITableview上显示Json数据。我的应用程序因以下原因而崩溃'-[\u NSCFString objectForKey:]:无法识别的选择器已发送到实例0x10a860840。我是Json新手

- (void)viewDidLoad
{
    [super viewDidLoad];

    NSError *error;
    NSString *url_string = [NSString stringWithFormat: @"http://api.geonames.org/citiesJSON?north=44.1&south=-9.9&east=-22.4&west=55.2&lang=de&username=demo"];

    NSURL *blogURL = [NSURL URLWithString:url_string];
    NSData *jsonData = [NSData dataWithContentsOfURL:blogURL];

    NSDictionary *dataDictionary = [NSJSONSerialization
                                    JSONObjectWithData:jsonData options:0 error:&error];
    //NSLog(@"Data : %@",dataDictionary);
    for (NSDictionary *bpDictionary in dataDictionary)
    {
        NSobjectClass *currenHotel = [[NSobjectClass alloc]initWithcountrycode:[bpDictionary
        objectForKey:@"countrycode"] name:[bpDictionary objectForKey:@"name"] toponmyName:[bpDictionary objectForKey:@"toponmyName"] population:[bpDictionary
                objectForKey:@"population"]];

        [self.objectHolderArray addObject:currenHotel];


}
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:
(NSInteger)section
{
    return [self.objectHolderArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:
(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    Cell1 *cell = [self.JsonTableview dequeueReusableCellWithIdentifier:CellIdentifier
                                                      forIndexPath:indexPath];
    NSobjectClass *currentHotel = [self.objectHolderArray
                                 objectAtIndex:indexPath.row];
    cell.countryCode.text = currentHotel.countrycode;
    cell.countryName.text = currentHotel.name;
    cell.countrytype.text = currentHotel.toponmyName;
    cell.population.text = currentHotel.population;
    return cell;
}

请检查我的密码

您需要从json中的顶级字典中提取数组
for(dataDictionary[@“geonames”]”中的NSDictionary*bpDictionary)
您需要从json中的顶级字典中提取数组<代码>用于(数据字典[@“geonames”]中的NSDictionary*bpDictionary)