Hi there!
I'm seeing the following crash when scrolling up a chat screen. This is happening randomly based on the actual chat content: fortunately I am able to always replicate it in a specific "chat room". The only way to avoid the crash is setting the showLoadEarlierMessagesHeader flag to NO. Any thoughts?
Thanks in advance!
: *** Assertion failure in -[UICollectionViewData validateLayoutInRect:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3512.30.14/UICollectionViewData.m:408
: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'layout attributes for supplementary item at index path (<NSIndexPath: 0xc000000000000016>
{length = 2, path = 0 - 0}) changed from <JSQMessagesCollectionViewLayoutAttributes: 0x15fc8cbb0> index path: (<NSIndexPath: 0xc000000000000016> {length = 2, path = 0 - 0}
); element kind: (UICollectionElementKindSectionHeader); frame = (0 0; 375 32); zIndex = 10; to <JSQMessagesCollectionViewLayoutAttributes: 0x15fc749b0> index path: (<NSIndexPath: 0xc000000000000016>
{length = 2, path = 0 - 0}
); element kind: (UICollectionElementKindSectionHeader); frame = (0 0; 375 32); zIndex = -1; without invalidating the layout'
As far as I have seen this crash is happening only if you call reloadData too often.
So I fixed this by just commenting out
else { attributesItem.zIndex = -1; }
in JSQMessagesCollectionViewFlowLayout.m.
Could anyone try this PR? https://github.com/jessesquires/JSQMessagesViewController/pull/1868