Uszkodzenie komórki prototypowej UISearchDisplayController i UITableView

mamUIViewController skonfigurować w serii ujęć za pomocątableview iUISearchDisplayController.

Próbuję użyć niestandardowej komórki prototypu z widoku własnego (która jest połączona z głównym widokiem tabeli w serii ujęć). Działa dobrze, jeśliself.tableview zwrócił co najmniej 1 komórkę, gdy ładuję widok, ale jeśliself.tableview nie ładuje komórki (ponieważ nie ma danych) i ładujęUISearchBar i szukaj,cellForRowAtIndexPath: zawiesza się metoda:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    CustomSearchCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"CustomSearchCell" forIndexPath:indexPath];

    [self configureCell:cell atIndexPath:indexPath];
    return cell;
}

-(void)configureCell:(CustomSearchCell *)cell atIndexPath:(NSIndexPath *)indexPath {
    User *user = [self.fetchedResultsController objectAtIndexPath:indexPath];

    cell.nameLabel.text = user.username;
}

Błędy:

*** Assertion failure in -[UITableViewRowData rectForRow:inSection:heightCanBeGuessed:]
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'request for rect at invalid index path (<NSIndexPath: 0x9ef3d00> {length = 2, path = 0 - 0})

Mój fetchedResultsController wydaje się mieć dane (1 sekcja, 2 wiersze) w punkcie, w którym powyższa metoda jest wywoływana. Awaria nadequeueReusableCellWithIdentifier linia.

Jakieś wskazówki / pomysły? Powinien usunąć kolejkę z prototypowej komórkiself.tableview, ale zgaduję, że nie było żadnegoself.tableview więc to jest przyczyna?

questionAnswers(4)

yourAnswerToTheQuestion