You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by so...@apache.org on 2017/03/17 07:11:32 UTC

[28/40] incubator-weex git commit: * [ios] reload index paths should not inculde delete index paths, otherwise it will cause crash: * Assertion failure in -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:

* [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.12-dev
Commit: d59aac4adc59edf0db0defde00e4ab336acb2090
Parents: 2bbf59a
Author: \u9690\u98ce <cx...@apache.org>
Authored: Thu Mar 16 16:12:52 2017 +0800
Committer: \u9690\u98ce <cx...@apache.org>
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];