Фон
Я пытаюсь повторно использовать ячейку PhotoCell, используемую для другого канала в этом канале. После установки некоторых точек останова мой код доходит до того, что получает ReusableCell из PhotoCell и выдает следующие ошибки:
2019-10-24 10:17:45.962720-0700 Gallery[15203:376468]
*** Assertion failure in -[UITableView _dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:],
/BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3899.13.13/UITableView.m:8589
2019-10-24 10:17:45.978775-0700 Gallery[15203:376468] ***
Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'unable to dequeue a cell with identifier EventFeedPhotoCell -
must register a nib or a class for the identifier
or connect a prototype cell in a storyboard'
Так что я знаю, где происходит ошибка, но мне не ясно, как ее отладить. через печатные заявления или тому подобное. Как я могу устранить эту проблему?
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
//Get a event feed photo cell
let cell = tableView.dequeueReusableCell(withIdentifier: Constants.Storyboard.eventFeedPhotoTableCell, for: indexPath) as! PhotoCell
//Get the photo for this row
let photo = photos[indexPath.row]
//Set the details for the cell
cell.setPhoto(photo)
return cell
}