Xcode的坑 Swift之TableView--*** Assertion failure in -[UITableView _configureCellForDisplay:forIndex...

纯代码绕行

*** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3600.7.47/UITableView.m:8174
这个错误有的人遇到过,有的人可能没遇到过,之前用的OC,storyboard的ViewController 里面拖的TableView,然后结合UITableViewCell 自定义Xib布局.
当然也有其他文章说的UITableviewcell 初始化方法不对的,如果是那种,建议先自己检查代码

下面说说这个坑,在OC中storyboard中拖入TableView,然后连线,dataSouce,delegate,ViewController代码里面就不用再遵循代理了,因为storyboard连线的时候,代理就自动实现了. 但是坑在swift中连线之后,并没有自动遵从代理,而是需要自己写 class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
},主要是之前一直用的OC,storyboard连线习惯了,以为swift storyboard也是这样连线就自动处理了

你可能感兴趣的:(Xcode的坑 Swift之TableView--*** Assertion failure in -[UITableView _configureCellForDisplay:forIndex...)