简体   繁体   中英

Crash when using iOS Accessibility with UITableView sections and it would crash after several [tableview reloadData]

将iOS Accessibility与UITableView部分一起使用时出现崩溃,该部分是可访问性元素,并且在多次[tableview reloadData]之后会崩溃。

It turns out that the [tableView reloadData] was being called from within a block - in other words being called from another thread.

The simple solution was the following:

- (void)blockTest
{
    [self displayData:YES animated:YES onCompletion:^(void) {
    [self performSelectorOnMainThread:@selector(updateTableData) withObject:nil waitUntilDone:YES];
    }];
}


- (void)updateTableData
{
    [self.tableView reloadData];
}

After that no more crashes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM