警告:不能加载任何Objective-C类信息。这将显著降低可用的类型信息的质量。

时间:2020-12-09 22:26:09

I have a problem when I get cell in UITableView. It cause of crash my app and show log:

当我在UITableView中获得单元格时,我有一个问题。它导致我的应用程序崩溃并显示日志:

warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available.

警告:不能加载任何Objective-C类信息。这将显著降低可用的类型信息的质量。

And it's my code:

这是我的代码:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    CustomCell *cell = [_theTableView cellForRowAtIndexPath:indexPath];
    CGSize labelSize = [cell.timeLabel.text sizeWithAttributes:@{NSFontAttributeName:cell.timeLabel.font}];
    CGFloat timeLabelHeight = labelSize.height;

It alway break and crash on line

它总是在直线上断裂。

CustomCell *cell = [_theTableView cellForRowAtIndexPath:indexPath];

Could you help me to solve it. Thanks.

你能帮我解决这个问题吗?谢谢。

1 个解决方案

#1


-1  

you should change the code you typed:

你应该改变你输入的代码:

CustomCell *cell = [_theTableView cellForRowAtIndexPath:indexPath];

to as following:

如下:

CustomCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath]

#1


-1  

you should change the code you typed:

你应该改变你输入的代码:

CustomCell *cell = [_theTableView cellForRowAtIndexPath:indexPath];

to as following:

如下:

CustomCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath]