*** Assertion failure in -[UISectionRowData refreshWithSection:tableView:tableViewRowData:], /Source
2014-11-18 09:18
741 查看
*** 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类型
解决方法:
1.在heightforrow方法里 做出判断
return (!isnan([LDCompanyDynamicCellgetCellHeight]))?[LDCompanyDynamicCellgetCellHeight]:70;
1在数据原始处修改,
+(CGFloat)getCellHeight:(LDCompanyModel *)company{
CGFloat intervalY = 5.0;
CGFloat y;
y+=55+intervalY;
if (company.industry) {
//协会认证
CGSize industrySize = [company.industry sizeWithFont:[UIFont systemFontOfSize:12.0] constrainedToSize:CGSizeMake([UIScreen mainScreen].bounds.size.width-76-10, CGFLOAT_MAX) lineBreakMode:NSLineBreakByWordWrapping];
y+=floor(industrySize.height)+intervalY;
}else{
y+=intervalY;
}
NSLog(@"y1-----%f",y);
y=floor(y);
NSLog(@"y2-----%f",y);
return y;
}
这是获取cell高度,打印的数据
2014-10-09 18:58:39.661 LiuDuSpace[7090:248073] y1-----79.000000
2014-10-09 18:58:39.661 LiuDuSpace[7090:248073] y2-----79.000000
2014-10-09 18:59:36.842 LiuDuSpace[7090:248073] y1-----nan
2014-10-09 18:59:36.842 LiuDuSpace[7090:248073] y2-----nan
第一次和第二次不一样,第一次正确,第二次为nan类型了,
将
CGFloat y=0;这样后,两次打印都正确了
可能是不给它一个初始值,它就不一定给你什么东西。。。
http://en.wikipedia.org/wiki/Uninitialized_variable 可以看看这个
转载:http://blog.csdn.net/wxw55/article/details/39935581
*** 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类型
解决方法:
1.在heightforrow方法里 做出判断
return (!isnan([LDCompanyDynamicCellgetCellHeight]))?[LDCompanyDynamicCellgetCellHeight]:70;
1在数据原始处修改,
+(CGFloat)getCellHeight:(LDCompanyModel *)company{
CGFloat intervalY = 5.0;
CGFloat y;
y+=55+intervalY;
if (company.industry) {
//协会认证
CGSize industrySize = [company.industry sizeWithFont:[UIFont systemFontOfSize:12.0] constrainedToSize:CGSizeMake([UIScreen mainScreen].bounds.size.width-76-10, CGFLOAT_MAX) lineBreakMode:NSLineBreakByWordWrapping];
y+=floor(industrySize.height)+intervalY;
}else{
y+=intervalY;
}
NSLog(@"y1-----%f",y);
y=floor(y);
NSLog(@"y2-----%f",y);
return y;
}
这是获取cell高度,打印的数据
2014-10-09 18:58:39.661 LiuDuSpace[7090:248073] y1-----79.000000
2014-10-09 18:58:39.661 LiuDuSpace[7090:248073] y2-----79.000000
2014-10-09 18:59:36.842 LiuDuSpace[7090:248073] y1-----nan
2014-10-09 18:59:36.842 LiuDuSpace[7090:248073] y2-----nan
第一次和第二次不一样,第一次正确,第二次为nan类型了,
将
CGFloat y=0;这样后,两次打印都正确了
可能是不给它一个初始值,它就不一定给你什么东西。。。
http://en.wikipedia.org/wiki/Uninitialized_variable 可以看看这个
转载:http://blog.csdn.net/wxw55/article/details/39935581
相关文章推荐
- *** Assertion failure in -[UISectionRowData refreshWithSection:tableView:tableViewRowData:], /Source
- 解决 Assertion failure in -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] crash的方法
- *** Assertion failure in -[UICollectionViewData validateLayoutInRect:], /SourceCache/UIKit_Sim/UIKit
- *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit
- Q6:关于xcode TableView使用Nib文件出现Assertion failure in dequeueReusableCellWithIdentifier:forIndexPath:错误
- TableView使用Nib文件出现的错误Assertion failure in dequeue
- "invalid master table data in row with PROCESS_ORDER=-4 Database Guard is enabled"
- Assertion failure in -[UITableView _dequeueReusableViewOfType:withIdentifier:], /BuildRoot/Library/C
- <ObjectC>解决 Assertion failure in -[UITableView _endCellAnimationsWithContext:] 问题
- *** Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], /BuildRoot
- *** Assertion failure in -[UICollectionViewData validateLayoutInRect:]
- *** Assertion failure in -[CompensaCommentView _dequeueReusableViewOfType:withIdentifier:],
- *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /BuildRoot/Library/Caches/co
- 删除cell时 报错 Assertion failure in -[UITableView _endCellAnimationsWithContext:]
- *** Assertion failure in -[AFStreamingMultipartFormData appendPartWithHeaders:body:]
- Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:]
- iOS-Assertion failure in -[AFStreamingMultipartFormData appendPartWithHeaders:body:]
- tableview 第一次可以查看tableview 当退出第二次却会出现Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
- Assertion failure in -[UITableView _endCellAnimationsWithContext:]---错误
- iOS 坑点 Assertion failure in - UITableView dequeueReusableCellWithIdentifier:forIndexPath: