-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Describe the bug
Fatal Exception:
NSInternalInconsistencyException attempt to delete and reload the same index path (<NSIndexPath: 0x2800dfa60> {length = 2, path = 0 - 0}) closure #1 in YPLibraryVC.photoLibraryDidChange(_:)
Expected behavior
Library should not crash
Environment (please complete the following information):
- Device: iPhone X
- OS: 12.1.4
- Xcode Version 10.1
- Swift Version 4.2
Installation Type
- Cocoapods
Additional context
Block
collectionView.performBatchUpdates({
let removedIndexes = collectionChanges!.removedIndexes
if (removedIndexes?.count ?? 0) != 0 {
collectionView.deleteItems(at: removedIndexes!.aapl_indexPathsFromIndexesWithSection(0))
}
let insertedIndexes = collectionChanges!.insertedIndexes
if (insertedIndexes?.count ?? 0) != 0 {
collectionView.insertItems(at: insertedIndexes!.aapl_indexPathsFromIndexesWithSection(0))
}
let changedIndexes = collectionChanges!.changedIndexes
if (changedIndexes?.count ?? 0) != 0 {
collectionView.reloadItems(at: changedIndexes!.aapl_indexPathsFromIndexesWithSection(0))
}
}, completion: nil)
Should be changed to
collectionView.performBatchUpdates({
let removedIndexes = collectionChanges!.removedIndexes
if (removedIndexes?.count ?? 0) != 0 {
collectionView.deleteItems(at: removedIndexes!.aapl_indexPathsFromIndexesWithSection(0))
}
let insertedIndexes = collectionChanges!.insertedIndexes
if (insertedIndexes?.count ?? 0) != 0 {
collectionView.insertItems(at: insertedIndexes!.aapl_indexPathsFromIndexesWithSection(0))
}
}, completion: { (finished) in
if finished {
let changedIndexes = collectionChanges!.changedIndexes
if (changedIndexes?.count ?? 0) != 0 {
collectionView.reloadItems(at: changedIndexes!.aapl_indexPathsFromIndexesWithSection(0))
}
}
})
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels