* [ios] reload index paths should not inculde delete index paths, otherwise it will cause crash: * Assertion failure in -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:]
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/d59aac4a Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/d59aac4a Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/d59aac4a Branch: refs/heads/0.11-dev Commit: d59aac4adc59edf0db0defde00e4ab336acb2090 Parents: 2bbf59a Author: éé£ <[email protected]> Authored: Thu Mar 16 16:12:52 2017 +0800 Committer: éé£ <[email protected]> Committed: Thu Mar 16 16:12:52 2017 +0800 ---------------------------------------------------------------------- .../Sources/Component/Recycler/WXRecyclerUpdateController.m | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d59aac4a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.m index 5666b4f..ca9c5f7 100644 --- a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.m +++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.m @@ -232,11 +232,14 @@ return; } + // reload index paths should not inculde delete index paths, otherwise it will cause crash: + // Assertion failure in + // -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:] + NSMutableSet *reloadIndexPaths = self.reloadIndexPaths ? [[diffResult.reloadIndexPaths setByAddingObjectsFromSet:self.reloadIndexPaths] mutableCopy]: [diffResult.reloadIndexPaths mutableCopy]; + [reloadIndexPaths minusSet:diffResult.deleteIndexPaths]; + [collectionView deleteItemsAtIndexPaths:[diffResult.deleteIndexPaths allObjects]]; [collectionView insertItemsAtIndexPaths:[diffResult.insertIndexPaths allObjects]]; - - NSSet *reloadIndexPaths = self.reloadIndexPaths ? [diffResult.reloadIndexPaths setByAddingObjectsFromSet:self.reloadIndexPaths] : diffResult.reloadIndexPaths; - [collectionView reloadItemsAtIndexPaths:[reloadIndexPaths allObjects]]; [collectionView deleteSections:diffResult.deleteSections];
