Search code examples
swiftviewcontrollersigabrtnsexceptionxcode9.4

XCode Thread 1: signal SIGABRT error terminating with uncaught exception of type NSException (lldb)


I ve searched many but couldnt find so here is my related screenshots:

https://postimg.cc/image/hyrkzet5z/

https://postimg.cc/image/wj8ntpdon/

Saying:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'

Everything works perfectly until I insert Stack View in Table View. Im kinda new in Xcode.

Thank you all!


Solution

  • This error occurs when you ask table view to dequeue a cell but it can't find that cell.

    Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
    

    In your cellForRowAtIndexPath method, table view is trying to dequeue a cell with an identifier of cell. Give an identifier to your cell if it's a prototype cell. If you are using a custom cell, then register your cell with table view in the viewDidLoad with the following code.

    tableView.register(CustomCell.self, forCellReuseIdentifier: "cell")