Assertion failure in UITableView configureCellForDisplay:forIndexPath:

Solution 1:

you are never creating a cell, you just try to reuse a dequeued cell. but as you never created one, there is none.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
    static NSString *cellIdentifier = @"cell";
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
    }

    NSString *currentValue = [shareValues objectAtIndex:[indexPath row]];
    [[cell textLabel]setText:currentValue];
    return cell;
}

or try (only iOS 6+)

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
    static NSString *cellIdentifier = @"cell";
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];

    NSString *currentValue = [shareValues objectAtIndex:[indexPath row]];
    [[cell textLabel]setText:currentValue];
    return cell;
}

from UITableView.h

- (id)dequeueReusableCellWithIdentifier:(NSString *)identifier;  // Used by the delegate to acquire an already allocated cell, in lieu of allocating a new one.
- (id)dequeueReusableCellWithIdentifier:(NSString *)identifier 
                           forIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(6_0); // newer dequeue method guarantees a cell is returned and resized properly, assuming identifier is registered

-dequeueReusableCellWithIdentifier: will always need a check, if a cell was returned, while
-dequeueReusableCellWithIdentifier:forIndexPath: can instantiate new one.

Solution 2:

If you have not defined a prototype cell with the identifier @"cell" in Storyboard, you will get an assertion error when you attempt to dequeue it.

You can fix this by setting the Identifier property on the prototype cell (select the cell and set that attribute in the right hand panel).

Solution 3:

A very silly mistake i had done was

i didn't put the UITableViewDelegate, UITableViewDataSource after the controller class name like my class code was class TagsViewController: UIViewController

it should have class TagsViewController: UIViewController , UITableViewDelegate, UITableViewDataSource

May be one of you is facing due to this all other code was ok.