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

博客园地址:http://www.cnblogs.com/HMJ-29/p/7573921.html
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 就设置默认高度

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容