美文网首页
[445:167413] *** Assertion failu

[445:167413] *** Assertion failu

作者: 大头Zanny | 来源:发表于2018-05-15 00:38 被阅读0次

 17:03:44.625661+0800 XXXX[445:167413] *** Assertion failure in -[BaseTableView _configureCellForDisplay:forIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3698.52.10/UITableView.m:9453

问题原因:

UITableview的datasource代理方法:

-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath

中,直接使用纯代码创建cell使用

UITableViewCell*cell = [tableViewdequeueReusableCellWithIdentifier:self.cellIdenifier];

方法可能返回cell为空,如果直接返回cell就会导致如上错误

解决办法:

是再需要判断下如果cell为空时如何处理,我添加了如下代码:

{

Classclassname =NSClassFromString(self.cellIdenifier);

if(!cell){

cell = [[classnamealloc]initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:self.cellIdenifier];

}

相关文章

网友评论

      本文标题:[445:167413] *** Assertion failu

      本文链接:https://www.haomeiwen.com/subject/eshekftx.html