Search code examples
iosswifttableviewreuseidentifier

Cell reuse identifier in nib does not match the identifier


My app crashes instantly as soon as it tries to make the table view, no idea what is wrong since the cell reuse identifier in nib matches the identifier used to register the nib. Would appreciate any help I'm using a virtual machine, so I can't copy-paste the error, so here is a print:

Error message:

Error Print

2021-06-23 17:57:51.392316+0100
    ArmazemProcessador[8986:25810358] *** Assertion
    failure in -[UITableView
    _dequeueReusableViewOfType:withIdentifier:],
    /BuildRoot/Library/Caches/com.apple
    •xbs/Sources/UIKitCore_Sim/UIKit-3899.22
    •15 UITableView.m:8566
2021-06-23 17:57:51.396208+0100
    ArmazemProcessador[8986:25810358] *** Terminating
    app due to uncaught exception
    'NSInternalInconsistencyException', reason: 'cell
    reuse identifier in nib (CutomTableViewCell) does
    not match the identifier used to register the nib
    (CustomTableViewCell)'
*** First throw call stack:

Solution

  • Looking at the crash - enter image description here

    It looks like -

    1. CustomTableViewCell.xib has the CutomTableViewCell value in the reuse identifier.
    2. When you did the tableView.registerNib call, you used CustomTableViewCell in the reuse identifier.

    These reuse identifier values must match.