Skip to content

UICollectionView crash in setTypingIndicatorHidden #1324

@kphns

Description

@kphns

Using MessageKit 3.0.0 or 3.1.0 on iOS 13.4, I get a crash that I did not get on previous versions of iOS 13.

When calling

messagesViewController.setTypingIndicatorViewHidden(false, animated: true)

I get:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to insert section 1 but there are only 1 sections after the update'

This is strange -- if I ask my data source before calling setTypingIndicatorViewHidden using:

print("collection view thinks there are 
\(messagesViewController?.messagesCollectionView.numberOfSections as Optional) sections,
 whereas the data source thinks there are 
\(messagesViewController?.messagesCollectionView.messagesDataSource?.numberOfSections(in: messagesViewController.messagesCollectionView) as Optional)")

I get:

collection view thinks there are Optional(1) sections, whereas the data source thinks there are Optional(23)

I am doing no other updates at the time. This appears whether or not I use any scrolling functions. My data is actually displaying as appropriate, so the data source is hooked up and functioning as expected. It's only when I try to show the typing indicator that I get this crash.

I've tried sprinkling calls to reloadData throughout, and nothing seems to help.

This does sound like a UICollectionView issue, but I am at a loss as to how to work around it (other than not using the typing indicator view, of course). Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions