Assertion failure in -[UISectionRowData refreshWithSection:tableView:tableViewRowData:], /SourceCache/UIKit/UIKit-2380.17/UITableViewRowData.m:400
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason:'Failed to allocate data stores for 997008923 rows in section 0. Consider using fewer rows'
my code
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [appDelegate.purchaseArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
return cell;
}
-(void)viewWillAppear:(BOOL)animated
{
[cartTbl reloadData];
}
我不明白这有什么问题?
检查你的tableView:heightForRowAtIndexPath:
。也许你会返回类似的东西NaN
/+inf
/-inf
而不是高度。那是我的错误。
请记住,这不是崩溃double
and float
除以零的类型:
double d = 5.0;
double r = d/0.0;
所以这可以帮助你:
if (isnan(r) || isinf(r)) {
// ...
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)