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
Crash when inserting items #12
Comments
That's interesting. This was a workaround, that exists from iOS 6, to fix known bug in UICollectionView, that crashes application when inserting first item in a section. Several things to try here, first: try to replace addItems: with setItems: call. Second, can i ask you to try running this code on iOS 8, and if possible, provide an example project? This is a workaround i always hoped to remove, however it does not seem like UICollectionView is playing nicely. I will definitely be revisiting code to see, whether it's possible to remove or clean up this workaround. |
I'm sorry, but I can't reproduce the issue anymore. Long version: I had to ship the first alpha of the project last Friday so I installed DTCollectionViewManager (I was hoping to save time: you know, the boilerplate CollectionView Data Source and Delegate). But it was crashing as I said earlier. Today, I updated to 4.1 and started again from scratch..and it works! (using both So, I think I was setting up the stack in the wrong way...? (but the code seems to be the same! It's nothing more than the example in quick start section of the readme). I'm sorry for the non-issue, I can just say thank you for the project, it's exactly what I was looking for. |
UICollectionView really puzzles me sometimes. I have same code running in DTTableViewManager without any workarounds whatsoever. Ok, so let's do it this way. I am closing this issue for now, but i'll investigate collection view updates code more, hopefully i'll figure out this stuff in next versions of a framework. Please, don't hesitate to create issue if you encounter one, i really want to make framework as stable as it can be, and other developers help and feedback are incredibly valuable to do that. 🍻 |
DTCollectionViewManager 4.2.0 is a release, aimed at stability of UI updates and storage handling code. Underlying storage was rewritten to allow better handling of UICollectionView updates. Workaround mentioned in this issue was entirely removed from a framework. So i'm happily closing this issue 🎉 |
CollectionViewManager crashes when it checks if it
shouldReloadCollectionViewToPreventInsertFirstItemIssueForUpdate
In particular, I'm asynchronously adding new items to the manager:
The manager then checks:
And crashes when calls
self.collectionView.numberOfItemsInSection(indexPath.section)
(in that moment, there were 0 sections with 0 items).Removing those lines make the app work correctly.
I run the app on the iOS 9 Simulator.
Exception logged:
The text was updated successfully, but these errors were encountered: