Это ошибка ...
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to delete row 4 from section 0 which only contains 0 rows before the update'
И код, при котором возникает эта ошибка, следующий:
cell.imageView?.sd_setImage(with: fileUrl as URL?, placeholderImage: placeholderImage,
options: [],
progress: nil,
completed: { (image, error, cacheType, imageURL) in
guard let image = image else { return }
//print("Image arrived!")
cell.imageView?.image = self.resizeImage(image: image, newWidth: 50)
let indexPath = NSIndexPath(row: self.usersArray.count-1, section: 0)
self.tableview.reloadRows(at: [indexPath as IndexPath], with: .none)
cell.isHidden = false
})
Когда я удаляю эти две строки, ошибка не возникает
let indexPath = NSIndexPath(row: self.usersArray.count-1, section: 0)
self.tableview.reloadRows(at: [indexPath as IndexPath], with: .none)
Но мне нужно перезагрузить TableView после загрузки изображений в ячейки.
Как это можно решить? Надеюсь, вы поможете мне, большое спасибо.