首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在iOS 9中如何避免后台线程

在iOS 9中如何避免后台线程
EN

Stack Overflow用户
提问于 2015-12-18 19:08:01
回答 1查看 71关注 0票数 0

我正在开发应用程序,我使用自定义的表格视图单元格来显示data.when,我的应用程序运行时会给出这个警告。

代码语言:javascript
复制
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

我添加了一些断点,并查看了一下,现在是时候了。在这一点上(我调用客户表格视图单元格的时候到了)。

代码语言:javascript
复制
- (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;

}

我试着用这个

代码语言:javascript
复制
dispatch_async(dispatch_get_main_queue(), ^{
    // code here
});

但是我不知道如何正确地使用它。有什么方法可以避免this.hope你的answers.thanx吗?

EN

回答 1

Stack Overflow用户

发布于 2015-12-18 19:11:50

cellForRowAtIndexPath:不应从后台线程调用。您可能正在从后台线程调用reloadData:或类似的东西,这是非常不健康的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34354246

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档