You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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))
}
}
})
The text was updated successfully, but these errors were encountered:
@Out1and3r Nice catch and Kudos for providing a working fix, this much much appreciated 👏
This will be in the next (swift 5) version.
I will ping when up :)
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):
Installation Type
Additional context
Block
Should be changed to
The text was updated successfully, but these errors were encountered: