Assertion error when reloading sections of UICollectionView in performBatchUpdates:
| Originator: | avedesk | ||
| Number: | rdar://28163205 | Date Originated: | 05-Sep-2016 10:00 PM |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | iOS 9.3.5 |
| Classification: | Other Bug | Reproducible: | Always |
Summary:
A collection view with 2 sections before update:
- section 0 has 4 cells
- section 1 has 0 cells
After update:
- section 0 should have 5 cells
- section 1 should have 0 cells
reloading the sections in performBatchUpdates: crashes with 'NSInternalInconsistencyException', reason: 'attempt to create view animation for nil view'
[self.collectionView performBatchUpdates:^{
[self.collectionView reloadSections:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)]];
} completion:nil];
Steps to Reproduce:
- see summary
Expected Results:
- No crash
Actual Results:
- crash
Regression:
Notes:
Assertion failure in -[UICollectionViewAnimation initWithView:viewType:finalLayoutAttributes:startFraction:endFraction:animateFromCurrentPostion:deleteAfterAnimation:customAnimations:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.60.7/UICollectionView.m:369
2016-09-05 21:55:25.960 app-dev[29987:3658222] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to create view animation for nil view'
*** First throw call stack:
(
0 CoreFoundation 0x0000000105e31d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000104f07deb objc_exception_throw + 48
2 CoreFoundation 0x0000000105e31bea +[NSException raise:format:arguments:] + 106
3 Foundation 0x0000000104b51d5a -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
4 UIKit 0x000000010890cbc9 -[UICollectionViewAnimation initWithView:viewType:finalLayoutAttributes:startFraction:endFraction:animateFromCurrentPostion:deleteAfterAnimation:customAnimations:] + 258
5 UIKit 0x000000010892c6f8 -[UICollectionView _viewAnimationsForCurrentUpdate] + 4103
6 UIKit 0x000000010893100c __62-[UICollectionView _updateWithItems:tentativelyForReordering:]_block_invoke1656 + 197
7 UIKit 0x000000010814c680 +[UIView(Animation) performWithoutAnimation:] + 65
8 UIKit 0x00000001089303b7 -[UICollectionView _updateWithItems:tentativelyForReordering:] + 3241
9 UIKit 0x000000010892b148 -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:] + 15572
10 UIKit 0x0000000108932497 -[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:] + 415
11 UIKit 0x00000001089322d5 -[UICollectionView _performBatchUpdates:completion:invalidationContext:] + 74
12 UIKit 0x0000000108932278 -[UICollectionView performBatchUpdates:completion:] + 53
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!