The accident occurred in the following situation:
We had a collection view controller that represented another view controller on it.
While the collection view controller was no longer visible, the following sequence of events occurred in response to our backward queries.
[UICollectionView insertItemsAtIndexPaths:] was called with 50 items as a collection of hidden UICollectionViewController .[UICollectionView reloadData] was invoked in a hidden collection view.- There was a short delay.
- The number of elements in the hidden view of the collection was set to a small number.
[UICollectionView reloadData] was called again.- The view controller was fired by showing the hidden collection view controller.
A confirmation error in the UIKit UICollectionViewData inner class will occur in step 6.
So, in the lesson, try to avoid manipulating the collection view, which is not displayed on the screen.
Our method of solving this problem was to call [UICollectionView reloadSections:] instead of [UICollectionView reloadData] at key points.
We suspect that the effects of reloadData delayed to some point in the future, and therefore there are subtle problems with how this can interact with other method calls, such as insertItemsAtIndexPaths , while reloadSections processed immediately, leaving the collection view in better condition.
We think that we did not see this behavior until we started creating our application for iOS 8.
Sleep well friends!
Drew Dec 16 '14 at 23:26 2014-12-16 23:26
source share