BnJ BnJ - 1 year ago 143
Objective-C Question

NSInternalInconsistencyException after UITableView reloadData

I have a problem when I add an object in the

linked to my
after a

I got this error :

*** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /SourceCache/UIKit_Sim/UIKit-3318.16.14/UITableView.m:7344
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'

Add :

self.relatedArtists = [[NSMutableArray alloc]init];

Artist* test = [[Artist alloc]init]; = @"Test 1";
[self.relatedArtists addObject:test];

Artist* test2 = [[Artist alloc]init]; = @"Test 2";
[self.relatedArtists addObject:test2];

[self.artists reloadData];


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.relatedArtists count];

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

UITableViewCell *cell = [self.artists dequeueReusableCellWithIdentifier:@"ARTIST_CELL_ID"];

Artist *artist = self.relatedArtists[indexPath.row];
cell.textLabel.text =;

return cell;

I think I missed something in the
file, but I don't see what...

Answer Source

I think you missed setting identifier of your tableView cell in storyboard to ARTIST_CELL_ID.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download