得到UITableView错误“无法使具有标识符单元格的单元出队". [英] Getting UITableView error "unable to dequeue a cell with identifier cell"

查看:162
本文介绍了得到UITableView错误“无法使具有标识符单元格的单元出队".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用UITableViewController创建一个应用程序,但出现错误:

I am creating an app with a UITableViewController but I am getting the error:

无法使带有标识符单元格的单元出队-必须为该标识符注册一个笔尖或一个类,或者在情节提要中连接原型单元格"

'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'

我不知道如何找到解决方案并加以解决.

I don't understand how I to find the solution and fix it.


2018-09-15 01:28:28.609848+0300 Yemekler[6554:482441] *** Assertion failure in -[UITableView _dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3698.54.4/UITableView.m:7879
2018-09-15 01:28:28.613237+0300 Yemekler[6554:482441] *** 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'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000112f461e6 __exceptionPreprocess + 294
    1   libobjc.A.dylib                     0x000000010f3ac031 objc_exception_throw + 48
    2   CoreFoundation                      0x0000000112f4b472 +[NSException raise:format:arguments:] + 98
    3   Foundation                          0x000000010ee4f652 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
    4   UIKit                               0x000000010fd8a496 -[UITableView _dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:] + 879
    5   UIKit                               0x000000010fd8a0f3 -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] + 91
    6   Yemekler                            0x000000010ea9de72 _T08Yemekler17YemekTarifleriTVCC9tableViewSo07UITableF4CellCSo0gF0C_10Foundation9IndexPathV12cellForRowAttF + 226
    7   Yemekler                            0x000000010ea9e34c _T08Yemekler17YemekTarifleriTVCC9tableViewSo07UITableF4CellCSo0gF0C_10Foundation9IndexPathV12cellForRowAttFTo + 92
    8   UIKit                               0x000000010fda5567 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 783
    9   UIKit                               0x000000010fda5ae4 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
    10  UIKit                               0x000000010fd6ceaa -[UITableView _updateVisibleCellsNow:isRecursive:] + 3168
    11  UIKit                               0x000000010fd8d7e0 -[UITableView layoutSubviews] + 176
    12  UIKit                               0x000000010fd177a8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1515
    13  QuartzCore                          0x00000001166b5456 -[CALayer layoutSublayers] + 177
    14  QuartzCore                          0x00000001166b9667 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395
    15  QuartzCore                          0x00000001166400fb _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 343
    16  QuartzCore                          0x000000011666d79c _ZN2CA11Transaction6commitEv + 568
    17  UIKit                               0x000000010fc62269 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 141
    18  CoreFoundation                      0x0000000112ee8b0c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    19  CoreFoundation                      0x0000000112ecd2db __CFRunLoopDoBlocks + 331
    20  CoreFoundation                      0x0000000112ecca84 __CFRunLoopRun + 1284
    21  CoreFoundation                      0x0000000112ecc30b CFRunLoopRunSpecific + 635
    22  GraphicsServices                    0x000000011583ea73 GSEventRunModal + 62
    23  UIKit                               0x000000010fc48057 UIApplicationMain + 159
    24  Yemekler                            0x000000010ea9c077 main + 55
    25  libdyld.dylib                       0x0000000114127955 start + 1
    26  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

推荐答案

@Sh_Khan指出.如果您使用的是原型单元,则可以在代码中注册该单元,也可以在情节提要中注册重用标识符.

As @Sh_Khan pointed out. You can register the cell in code or you can also register the reuse identifier in Storyboard, if you are using prototype cells.

这篇关于得到UITableView错误“无法使具有标识符单元格的单元出队".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆