I m getting this error on performing insertItemsAtIndexPaths
in UICollectionView
Assertion failure in:
-[UICollectionViewD
Inserting section#0 just before inserting cells seems make UICollectionView happy.
NSArray *indexPaths = /* indexPaths of the cells to be inserted */
NSUInteger countBeforeInsert = _cells.count;
dispatch_block_t updates = ^{
if (countBeforeInsert < 1) {
[self.collectionView insertSections:[NSIndexSet indexSetWithIndex:0]];
}
[self.collectionView insertItemsAtIndexPaths:indexPaths];
};
[self.collectionView performBatchUpdates:updates completion:nil];