XCode 线程 1:信号 SIGABRT 错误终止,并出现 NSException (lldb) 类型的未捕获异常



我已经搜索了很多,但找不到,所以这是我的相关屏幕截图:

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

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

谚语:

由于未捕获的异常"NSInternalInconsistencyException"而终止应用,原因:"无法使用标识符单元格取消单元的排队 - 必须为标识符注册 nib 或类,或者在情节提要中连接原型单元格">

一切都很完美,直到我在表格视图中插入堆栈视图。我在Xcode中有点新。

谢谢大家!

当您要求表视图取消单元格排队但找不到该单元格时,会发生此错误。

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'

cellForRowAtIndexPath方法中,表视图正在尝试将标识符为cell的单元格取消排队。如果单元格是原型单元格,请为其提供标识符。如果使用的是自定义单元格,请使用以下代码在viewDidLoad中向表视图注册单元格。

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

最新更新