Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

[iOS]Catch exception 'NSInternalInconsistencyException', reason: 'Mis… #1628

Merged
merged 1 commit into from
Oct 11, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions ios/sdk/WeexSDK/Sources/Component/WXListComponent.mm
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,12 @@ - (void)_performUpdates:(void(^)(void))updates withKeepScrollPosition:(BOOL)keep
- (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];
Expand All @@ -917,7 +922,13 @@ - (void)_insertTableViewSectionAtIndex:(NSUInteger)section keepScrollPosition:(B
- (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];
Expand All @@ -933,7 +944,12 @@ - (void)_insertTableViewCellAtIndexPath:(NSIndexPath *)indexPath keepScrollPosit
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"]) {
Expand All @@ -950,7 +966,12 @@ - (void)_deleteTableViewCellAtIndexPath:(NSIndexPath *)indexPath keepScrollPosit
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];
Expand Down