【发布时间】:2015-12-18 11:08:01
【问题描述】:
我正在开发应用程序,我使用自定义表格视图单元格来显示数据。当我的应用程序运行时,它会发出此警告。
This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release
我已经添加了一些断点并查看了,这是什么时候来的。在这一点上(我调用客户表视图单元格的时间。)
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
AirportTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"identifier"];//in here it comes
ac = [detailArray objectAtIndex:indexPath.row];
cell.airportname.text = ac.airPort;
return cell;
}
我试过了
dispatch_async(dispatch_get_main_queue(), ^{
// code here
});
但我不知道如何正确使用它。有什么办法可以避免这种情况。希望你的回答。谢谢
【问题讨论】:
-
那么,你在哪里进入后台线程?那会更有趣,因为您当前的狙击手实际上给出的线索为零,但您的
AirportTableViewCell中只是偷偷怀疑它正在发生,您还没有优雅地与我们分享。
标签: ios9 custom-cell background-thread