警告:无法加载任何 Objective-C 类信息.这将大大降低可用类型信息的质量



当我在UITableView中获取单元格时遇到问题。它导致我的应用程序崩溃并显示日志:

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

这是我的代码:

- (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;

它总是在线中断和崩溃

CustomCell *cell = [_theTableView cellForRowAtIndexPath:indexPath];

你能帮我解决它吗?谢谢。

您应该更改键入的代码:

CustomCell *cell = [_theTableView cellForRowAtIndexPath:indexPath];

如下:

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

最新更新