I am presenting list of items in UICollectionView and when callback function is called, I am updating array of items, and redrawing collection, but application crashes each time with next message:
*** Assertion failure in -[UICollectionView _endItemAnimations], /SourceCache/UIKit/UIKit-3318.16.25/UICollectionView.m:3765
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to insert item 1 into section 0, but there are only 1 items in section 0 after the update'
code which I am using is:
items = [databaseManager getNewItems];
[self.collectionView performBatchUpdates:^{
[self.collectionView reloadItemsAtIndexPaths:[self.collectionView indexPathsForVisibleItems]];
[self.collectionView reloadData];
} completion:^(BOOL finished) {}];