dog*_*kis 4 uitableview tableview ios swift
我正在使用 UITableViewController 创建应用程序,但收到错误:
“无法使用标识符单元使单元出列 - 必须为标识符注册笔尖或类,或者在情节提要中连接原型单元”
我不明白如何找到解决方案并修复它。
2018-09-15 01:28:28.609848 + 0300 Yemekler [6554:482441] *** -[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] *** 由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“无法使具有标识符单元格的单元格出队 - 必须注册笔尖或类用于标识符或连接故事板中的原型单元' *** 首先抛出调用堆栈: ( 0 核心基础 0x0000000112f461e6 __exceptionPreprocess + 294 1 libobjc.A.dylib 0x000000010f3ac031 objc_异常_抛出 + 48 2 CoreFoundation 0x0000000112f4b472 +[NSException 引发:格式:参数:] + 98 3 基础 0x000000010ee4f652 -[NSAssertionHandler handleFailureInMethod:对象:文件:行号:描述:] + 193 4 UIKit 0x000000010fd8a496 -[UITableView _dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:] + 879 5 UIKit 0x000000010fd8a0f3 -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] + 91 6 耶梅克勒 0x000000010ea9de72 _T08Yemekler17YemekTarifleriTVCC9tableViewSo07UITableF4CellCSo0gF0C_10Foundation9IndexPathV12cellForRowAttF + 226 7 耶梅克勒 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布局子视图] + 176 12 UIKit 0x000000010fd177a8 - [UIView(CALayerDelegate)layoutSublayersOfLayer:] + 1515 13 QuartzCore 0x00000001166b5456 -[CALayer布局子层] + 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 核心基础 0x0000000112ee8b0c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12 19 核心基础 0x0000000112ecd2db __CFRunLoopDoBlocks + 331 20 核心基础 0x0000000112ecca84 __CFRunLoopRun + 1284 21 核心基础 0x0000000112ecc30b CFRunLoopRunSpecific + 635 22 图形服务 0x000000011583ea73 GSEventRunModal + 62 23 UIKit 0x000000010fc48057 UIApplicationMain + 159 24 耶梅克勒 0x000000010ea9c077 主 + 55 25 libdyld.dylib 0x0000000114127955 开始 + 1 26 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib:以 NSException 类型的未捕获异常终止
viewDidLoad
在使用xib出列之前,您需要使用单元格注册表格
tableView.register(UINib(nibName: "TableCell", bundle: nil), forCellReuseIdentifier: "cell")
Run Code Online (Sandbox Code Playgroud)
或者
tableView.register(TableCell.self, forCellReuseIdentifier: "cell")
Run Code Online (Sandbox Code Playgroud)
从崩溃中可以清楚地看出
无法使带有标识符单元格的单元格出列 - 必须为标识符注册笔尖或类,或者连接情节提要中的原型单元格'
归档时间: |
|
查看次数: |
4629 次 |
最近记录: |