UIKit isn’t thread safe. The UI should only be updated from main thread:
dispatch_async(dispatch_get_main_queue()) {
self.tableView.reloadData()
}
Update. In Swift 3 and later use:
DispatchQueue.main.async {
self.tableView.reloadData()
}
More Related Contents:
- Giving certain cells different background colors and borders?
- the last UITableViewCell don’t have a separating line
- How can I debug ‘unrecognized selector sent to instance’ error
- UITableView example for Swift
- reloadData() of UITableView with Dynamic cell heights causes jumpy scrolling
- didSelectRowAtIndexPath not working, Swift 3
- UIButton action in table view cell
- Issue Detecting Button cellForRowAt
- How to reload data in a TableView from a different ViewController in Swift
- Missing return UITableViewCell
- Dynamic Height Issue for UITableView Cells (Swift)
- UITableViewCell with dynamic height iOS
- One timer per table view cell
- Multiple UILabels inside a self sizing UITableViewCell
- Autolayout is ignored in Custom UITableViewCell
- How to detect one button in tableview cell
- Swift – How creating custom viewForHeaderInSection, Using a XIB file?
- Type ‘ViewController’ does not conform to protocol ‘UITableViewDataSource’
- How to get data from firebase in descending order of value?
- Custom UITableViewCell programmatically using Swift
- How to keep UITableView contentoffset after calling -reloadData
- Swift tableView Pagination
- UITableViewCell checkmark to be toggled on and off when tapped
- How to add image in UITableViewRowAction?
- What is the correct way to use prepareForReuse?
- iOS TableView reload and scroll top
- Download and cache images in UITableViewCell
- Set UITableView’s height to the height of its content with Auto Layout
- How to Set UITableViewCellStyleSubtitle and dequeueReusableCell in Swift?
- UITableView auto resizing row constraint breaking mysteriously on iPhone 6Plus