Xcode error: unable to dequeue a cell with identifier MealTableViewCell

This works for me..

my Scene

Attributes inspector

and I'm using a different identifier, "DeviceDetailsCell"

let cellIdentifier = "DeviceDetailsCell"
    let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! DeviceDetailsTableViewCell

Just for the record, here's how I solved my issue:

I took the current identifier that was in the attributes inspector, deleted it, pressed return and clicked away. After that, I clicked back into the identifier text box and re-typed the identifier and pressed return. I then saved the storyboard file and it worked when I ran it.


In my case I was taking the UITableViewCell from a separate xib file (i.e., not inserting the cell directly in the tableView in storyBoard) and I forgot to properly register the cell in the tableView in this way:

self.tableView.register(UINib(nibName: "NAME_OF_THE_CELL_CLASS", bundle: nil), forCellReuseIdentifier: "REUSE_IDENTIFIER");

Tags:

Ios

Xcode

Swift