Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UICollectionView Assertion failure in -[UICollectionView _updateWithItems:tentativelyForReordering:]

iOS8.4. On device not simulator.

I'm getting this carsh error;

Assertion failure in -[UICollectionView _updateWithItems:tentativelyForReordering:], /SourceCache/UIKit/UIKit-3347.44.2/UICollectionView.m:4563

When I call

NSArray* array_indexPaths = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:1 inSection:0]];
[self.collectionView reloadItemsAtIndexPaths:indexPaths];

have tried putting the above inside [self.collectionView performBatchUpdates:^{ with no luck.

Is there anyone else who has experienced this or knows why it's happening?

like image 280
Geoff H Avatar asked Jul 15 '15 17:07

Geoff H


1 Answers

I found this rdar: http://www.openradar.me/26280932 which says:

Calling insertItemsAtIndexPaths: on UICollectionView after viewDidLoad but before viewDidAppear: will cause an assertion failure in -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:]. Calling reloadData in the same scenario doesn't generate the assertion.

So you could check if you are doing your call before viewDidAppear and adjust/wait before view did appear.

like image 102
heyfrank Avatar answered Sep 28 '22 03:09

heyfrank