diff --git a/Source/IGListDiffKit/IGListExperiments.h b/Source/IGListDiffKit/IGListExperiments.h index 72d6da40f..3ebb787dc 100644 --- a/Source/IGListDiffKit/IGListExperiments.h +++ b/Source/IGListDiffKit/IGListExperiments.h @@ -23,7 +23,9 @@ typedef NS_OPTIONS (NSInteger, IGListExperiment) { /// Test skipping creating {view : section controller} map, which has inconsistency issue. IGListExperimentSkipViewSectionControllerMap = 1 << 4, /// Use the correct section index when calling -[IGListAdapter reloadObjects ...] within the update block. - IGListExperimentFixCrashOnReloadObjects = 1 << 5 + IGListExperimentFixCrashOnReloadObjects = 1 << 5, + /// Throw NSInternalInconsistencyException during an update + IGListExperimentThrowOnInconsistencyException = 1 << 6 }; /** diff --git a/Source/IGListKit/Internal/IGListBatchUpdateTransaction.m b/Source/IGListKit/Internal/IGListBatchUpdateTransaction.m index 96ab93bcc..9cdf98b9c 100644 --- a/Source/IGListKit/Internal/IGListBatchUpdateTransaction.m +++ b/Source/IGListKit/Internal/IGListBatchUpdateTransaction.m @@ -217,7 +217,10 @@ - (void)_applyDiff:(IGListIndexSetResult *)diffResult { } } @catch (NSException *exception) { - if ([[exception name] isEqualToString:NSInternalInconsistencyException]) { + /// Currently, we don't throw on `NSInternalInconsistencyException`, like the comment below explains. This was a temporary workaround for the large + /// volume of exceptions that started with Xcode 14.3. Now, lets use this experiment flag to slowly reintroduce it, and eventually remove the workaround. + const BOOL ignoreException = !IGListExperimentEnabled(self.config.experiments, IGListExperimentThrowOnInconsistencyException); + if (ignoreException && [[exception name] isEqualToString:NSInternalInconsistencyException]) { /// As part of S342566 we have to recover from crashing the app since Xcode 14.3 has shipped /// with a different build SDK that changes the runtime behavior of -performBatchUpdates: issues. /// When we are performing batch updates, it's on us to advance the data source to the new state