JSQMessagesViewController icon indicating copy to clipboard operation
JSQMessagesViewController copied to clipboard

Crash while scrolling

Open matteinn opened this issue 10 years ago • 10 comments

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'

matteinn avatar Feb 01 '16 10:02 matteinn

As far as I have seen this crash is happening only if you call reloadData too often.

matteinn avatar Feb 15 '16 18:02 matteinn

+1

ihorb10 avatar Apr 29 '16 21:04 ihorb10

+1

Sujit51 avatar Jun 22 '16 05:06 Sujit51

+1

ryanthon avatar Jul 05 '16 19:07 ryanthon

+1

nikhilvdev avatar Jul 22 '16 10:07 nikhilvdev

+1

ippily avatar Aug 09 '16 16:08 ippily

So I fixed this by just commenting out

else { attributesItem.zIndex = -1; }

in JSQMessagesCollectionViewFlowLayout.m.

ryanthon avatar Aug 25 '16 04:08 ryanthon

+1

jaddoescad avatar Sep 05 '16 08:09 jaddoescad

Could anyone try this PR? https://github.com/jessesquires/JSQMessagesViewController/pull/1868

algrid avatar Oct 16 '16 22:10 algrid

+1

saltwat5r avatar Jun 07 '17 09:06 saltwat5r