I m getting this error on performing insertItemsAtIndexPaths in UICollectionView
Assertion failure in:
-[UICollectionViewData indexPathForItemAtGlobalIndex:],
/SourceCache/UIKit/UIKit-2372/UICollectionViewData.m:442
2012-09-26 18:12:34.432
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'request for index path for global index 805306367
when there are only 1 items in the collection view'
I have checked and my datasource contains only one element.
Any insights on why this could happen? If more information is needed I can definitely provide that.
I ran into this very same problem when inserting the first cell into a collection view. I fixed the problem by changing my code so that I call the UICollectionView
method when inserting the first cell, but
when inserting all other cells.
Interestingly, I also had a problem with
when deleting the last cell. I did the same thing as before: just call
reloadDatawhen deleting the last cell.