Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QMChatCollectionView crashes at performBatchUpdates #273

Closed
kevb10 opened this issue Jan 27, 2016 · 6 comments
Closed

QMChatCollectionView crashes at performBatchUpdates #273

kevb10 opened this issue Jan 27, 2016 · 6 comments

Comments

@kevb10
Copy link

kevb10 commented Jan 27, 2016

Using:
QMCVDevelopment 0.3.3 (was 0.3.3)
QMServicesDevelopment 0.3.5 (was 0.3.4)
QuickBlox 2.6.3 (was 2.6.2)

I can start a conversation thread and get out of there but if I go back in, it throws an error in the QMChatViewController.m file line 271:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of sections. The number of sections contained in the collection view after the update (1) must be equal to the number of sections contained in the collection view before the update (1), plus or minus the number of sections inserted or deleted (1 inserted, 0 deleted).' ***
And I pretty much followed your demo code. (http://quickblox.com/developers/SimpleSample-chat_users-ios#How_to_start)

@Raikerian
Copy link

Hi,

Are you unsubscribing from QBChat delegate when leaving chat controller?

@kevb10
Copy link
Author

kevb10 commented Jan 27, 2016

@Raikerian
Copy link

Can you send me a test/sample project with this crash being reproducible?

@kevb10
Copy link
Author

kevb10 commented Jan 28, 2016

Go ahead and clone https://github.com/kevb10/KevChatDemo
(using cocoapods)

@Raikerian
Copy link

You are trying to perform animation before view did appear.

Just replace in viewWillAppear:

// Retrieving messages
    if ([[self storedMessages] count] > 0 && self.totalMessagesCount == 0) {

        [self insertMessagesToTheBottomAnimated:[self storedMessages]];
        [self refreshMessagesShowingProgress:NO];
    }

with

// Retrieving messages
    if ([[self storedMessages] count] > 0 && self.totalMessagesCount == 0) {

        [self updateDataSourceWithMessages:[self storedMessages]];
        [self refreshMessagesShowingProgress:NO];
    }

@kevb10
Copy link
Author

kevb10 commented Jan 29, 2016

Awesome. That solved the problem. 👍

@kevb10 kevb10 closed this as completed Jan 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants