0

I'm working on app and I used custom tableview cell to dispalay data.when my app runs it gives this warning.

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

I have added some breakpoints and looked, which time this comes. in this point it comes(the time I call to the custome table view cell.)

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

}

I tried with this

dispatch_async(dispatch_get_main_queue(), ^{
    // code here
});

but I don't know how to use it in proper way. is there any way to avoid this.hope your answers.thanx

Jobs
  • 269
  • 2
  • 6
  • 21
  • so, where do you go into a background thread? that would be more interesting to see, because your current snipper actually gives zero clue, but only a sneaking suspicion about it is happening in your `AirportTableViewCell`, which you have gracefully not shared with us yet. – holex Dec 18 '15 at 11:18

1 Answers1

0

cellForRowAtIndexPath: shouldn't be called from a background thread. You are probably calling reloadData: or something similar from a background thread, and that is very unhealthy.

gnasher729
  • 51,477
  • 5
  • 75
  • 98