BeginUpdates endUpdates crash with nothing in between

I am completely confused. I change my table and it crashes adding / removing lines and reboot sections. So I stopped adding and removing lines and it still crashes. So I stopped reloading partitions and it still crashes. So I just put the code:

        [self.tableView beginUpdates];
        [self.tableView endUpdates];

      

with this code it crashes, without it.

Why?

2014-09-12 21: 52: 41.257 weatherApp [12616: 60b] * Application terminated due to uncaught "NSRangeException", reason: '* - [__ NSArrayM objectAtIndex:]: index 1 outside [0, 0]' * The first roll call stack: (0x2ea84f83 0x392ffccf 0x2e9bb7cb 0x3149eaef 0x3149cd8f 0x3149c843 0x31474e5b 0xeb82d 0xed059 0x313d48f7 0x3137bc27 0x3137b47d 0x312a1d59 0x30f1f62b 0x30f1ae3b 0x30f1accd 0x30f1a6df 0x30f1a4ef 0x30f6dc49 0x33d3a75d 0x2f770451 0x2ea44ea9 0x2ea4fa67 0x2ea4fa03 0x2ea4e1d7 0x2e9b8ebf 0x2e9b8ca3 0x33912663 0x3130514d 0x107599 0x3980cab7) libS ++ abi.dylib: uncaught exception completion with of type NSException

Edit: It should be advised that I am calling this update in cellForRowAtIndexPath because I need to check for an update when new cells are displayed. The code that triggers this update is the [self updateSection code, which now only triggers updates, finishes updates.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

WFHNotamTableViewCell *cell = (WFHNotamTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellTableIdentifier forIndexPath:indexPath];
if (!cell)
{
    NSLog(@"Dequeue blank cell");
}
NSLog(@"Loading %d - %d", indexPath.section, indexPath.row);
NSString *group;
NSString *icao = [metarManager getIdentifierAtTotalIndex:indexPath.section andReturnGroup:&group];
NSMutableDictionary *notamDict = [notamManager getNotamFor:icao atVisibleIndex:indexPath.row];

NSDate *lastUpdate = [notamDict objectForKey:@"timeDownloaded"];

[self updateSection:indexPath.section andLastUpdate:lastUpdate];

return cell;

      

Thank!

+3


source to share





All Articles