How to Solved Assertion failed: Invalid cell given to presenter issue
- Dominant language
- Swift
- Stars
- 4.6k
- Forks
- 588
- PR merge metrics
- No merged PRs in 30d
Description
I populated API data on chat view controller. Not able to receive photo messages. When someone send a photo message then app crash in BaseMessagePresenter's configure cell function.
Error in line no 88 :Assertion failed: Invalid cell given to presenter issue
`
public final override func configureCell(_ cell: UICollectionViewCell, decorationAttributes:
ChatItemDecorationAttributesProtocol?)
{
guard let cell1 = cell as? CellT else {
assert(false, "Invalid cell given to presenter")
return
}
guard let decorationAttributes = decorationAttributes as? ChatItemDecorationAttributes else {
assert(false, "Expecting decoration attributes")
return
}
print("print cell cellT :\(type(of:cell1))")
self.decorationAttributes = decorationAttributes
self.configureCell(cell1, decorationAttributes: decorationAttributes, animated: false, additionalConfiguration: nil)
}`
Contributor guide
Research direction
Start in BaseMessagePresenter's configureCell function at line 88 and trace how the chat view controller registers and supplies cells for photo messages. Reproduce the crash with a photo message and inspect the cell type passed to configureCell. Done means photo messages no longer trigger the invalid-cell assertion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100