You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by cx...@apache.org on 2018/10/11 11:47:36 UTC

[incubator-weex] branch master updated: [iOS]Catch exception 'NSInternalInconsistencyException', reason: 'Missing cell for newly visible row 8'. It's a iOS bug, It disappear after iOS11.2. (#1628)

This is an automated email from the ASF dual-hosted git repository.

cxfeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git


The following commit(s) were added to refs/heads/master by this push:
     new c07d81b  [iOS]Catch exception 'NSInternalInconsistencyException', reason: 'Missing cell for newly visible row 8'. It's a iOS bug, It disappear after iOS11.2. (#1628)
c07d81b is described below

commit c07d81bb9eb09d193d7439303c1a83c536b63d32
Author: mahaiyannn <ma...@gmail.com>
AuthorDate: Thu Oct 11 19:47:31 2018 +0800

    [iOS]Catch exception 'NSInternalInconsistencyException', reason: 'Missing cell for newly visible row 8'. It's a iOS bug, It disappear after iOS11.2. (#1628)
    
    . https://github.com/mahaiyannn/TableViewExceptionDemo.git is the reproduction demo
---
 .../WeexSDK/Sources/Component/WXListComponent.mm   | 29 +++++++++++++++++++---
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.mm b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.mm
index 55116af..b4cc6c7 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.mm
+++ b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.mm
@@ -904,7 +904,12 @@
 - (void)_insertTableViewSectionAtIndex:(NSUInteger)section keepScrollPosition:(BOOL)keepScrollPosition animation:(UITableViewRowAnimation)animation
 {
     [self _performUpdates:^{
-        [_tableView insertSections:[NSIndexSet indexSetWithIndex:section] withRowAnimation:animation];
+        // catch system exception under 11.2 https://forums.developer.apple.com/thread/49676
+        @try {
+            [_tableView insertSections:[NSIndexSet indexSetWithIndex:section] withRowAnimation:animation];
+        } @catch(NSException *) {
+            
+        }
     } withKeepScrollPosition:keepScrollPosition adjustmentBlock:^CGFloat(NSIndexPath *top) {
         if (section <= top.section) {
             return [self tableView:_tableView heightForHeaderInSection:section];
@@ -917,7 +922,13 @@
 - (void)_deleteTableViewSectionAtIndex:(NSUInteger)section keepScrollPosition:(BOOL)keepScrollPosition animation:(UITableViewRowAnimation)animation
 {
     [self _performUpdates:^{
-        [_tableView deleteSections:[NSIndexSet indexSetWithIndex:section] withRowAnimation:animation];
+        // catch system exception under 11.2 https://forums.developer.apple.com/thread/49676
+        @try {
+            [_tableView deleteSections:[NSIndexSet indexSetWithIndex:section] withRowAnimation:animation];
+        } @catch(NSException *) {
+            
+        }
+
     } withKeepScrollPosition:keepScrollPosition adjustmentBlock:^CGFloat(NSIndexPath *top) {
         if (section <= top.section) {
             return [self tableView:_tableView heightForHeaderInSection:section];
@@ -933,7 +944,12 @@
         if ([_updataType  isEqual: @"reload"]) {
             [_tableView reloadData];
         } else {
-            [_tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:animation];
+            // catch system exception under 11.2 https://forums.developer.apple.com/thread/49676
+            @try {
+                [_tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:animation];
+            } @catch(NSException *e) {
+                
+            }
         }
     } withKeepScrollPosition:keepScrollPosition adjustmentBlock:^CGFloat(NSIndexPath *top) {
         if (([indexPath compare:top] <= 0) || [_updataType  isEqual: @"reload"]) {
@@ -950,7 +966,12 @@
         return ;
     }
     [self _performUpdates:^{
-        [_tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:animation];
+        // catch system exception under 11.2 https://forums.developer.apple.com/thread/49676
+        @try {
+            [_tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:animation];
+        } @catch (NSException* e) {
+            
+        }
     } withKeepScrollPosition:keepScrollPosition adjustmentBlock:^CGFloat(NSIndexPath *top) {
         if ([indexPath compare:top] <= 0) {
             return [self tableView:_tableView heightForRowAtIndexPath:indexPath];