1
votes

Getting this error when I load my tableview and I'm not sure why:

Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /SourceCache/UIKit_Sim/UIKit-3318.16.14/UITableView.m:7344

I've added a UITableViewController in my storyboard and I'm using the prototype cells to design the cell. I linked the cell to my custom UITableViewCell subclass and I set its reuse identifier to "Cell". I am getting the assertion failure when I call dequeueReusableCellWithIdentifier in cellForRowAtIndexPath. From what I've read, this happens when I don't set the reuse identifier in the prototype cell, however I've checked countless times and it's the same identifier I'm using when I dequeue it.

Here are my datasource methods In the UITableViewController subclass:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
}

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

    return cell;
}
2
try adding cell identifier in storyboard - Sam
@Sam I've added an identifier named "Cell" to the prototype cell in the storyboard - thisiscrazy4
just try changing identifier name other than Cell if it works - Sam
can you share sample app on Dropbox - Sam

2 Answers

0
votes

Try to use

[self.tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];

instead of dequeueReusableCellWithIdentifier

0
votes

You have to register the tableviewcell with the given reusablecellidentifier "Cell".

Example code is given below.

[yourTableView registerNib:[UINib nibWithNibName:@"YouTableViewCellNibName" bundle:nil] forCellReuseIdentifier:@"CellIdentifier"];