Assertion failure in -[UISectionRowData refreshWithSection:tableView:tableViewRowData:], /Source

1、

*** Assertion failure in -[UISectionRowData refreshWithSection:tableView:tableViewRowData:], /SourceCache/UIKit_Sim/UIKit-3600/UITableViewRowData.m:485

本人遇到此问题是因为为了适配 iOS11 增加的代码,也在其他 iOS 版本中添加而造成的,只要做下面处理即可:

if #available(iOS 11.0, *) {
    //适配iOS11的代码
}

 

2、

*** Assertion failure in -[UISectionRowData refreshWithSection:tableView:tableViewRowData:], /SourceCache/UIKit_Sim/UIKit-3318.16.14/UITableViewRowData.m:619

 

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'table view row height must not be negative - provided height for index path (<UIMutableIndexPath 0x7fc9a368f0b0> 2 indexes [0, 0]) is nan'

 

报错原因是  在tableview的heightForRow方法里返回的数据错误,返回的数据是nan型的,为什么是nan呢,猜测可能是数据越界,你可能得到到的是double类型,而heightforrow需要的是CGFloat类型

 解决方法:

在height for row方法里 做出判断,如果height == nan 就设置默认高度

 第二个问题本人并没有遇到,在找寻答案时发现有人遇到过上面问题就集中放一起。

posted on 2017-09-22 11:22  MJ_Angel  阅读(1028)  评论(0编辑  收藏  举报

导航