xmartlabs/XLPagerTabStrip

CRASH: Invalid batch updates detected: the number of sections and/or items returned by the data source before and after performing the batch updates are inconsistent with the updates.

Opened this issue · 0 comments

Environment:

  • XLPagerTabStrip: 9.1.0,
  • Xcode: 14.3.1
  • iOS version: 17.1.2
  • iPhone: 14 Pro

Crash Stack Trace:
Fatal Exception: NSInternalInconsistencyException
Invalid batch updates detected: the number of sections and/or items returned by the data source before and after performing the batch updates are inconsistent with the updates. Data source before updates = { 1 section with item counts: [4] } Data source after updates = { 1 section with item counts: [1] } Updates = [ ] Collection view: <XLPagerTabStrip.ButtonBarView: 0x10585f000; baseClass = UICollectionView; frame = (0 168; 393 40); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x28147f690>; backgroundColor = <UIDynamicSystemColor: 0x280f4af00; name = systemBackgroundColor>; layer = <CALayer: 0x281a79800>; contentOffset: {0, 0}; contentSize: {518.66666666666663, 40}; adjustedContentInset: {0, 0, 0, 0}; layout: <UICollectionViewFlowLayout: 0x104230090>; dataSource: <CrelioHealth_for_Doctors.WaitingListView: 0x10602e200>>

Example Code
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { return getChildViewControllers() }

private func getChildViewControllers() -> [UIViewController] { guard let presenter = self.presenter else { return [] } var childViewControllers = [UIViewController]() testMenuArray.enumerated().forEach { (index, testMenuName) in let childView = presenter.createSwipeViews(index: index, lastFromDate: lastAPIcallFromDate, lastToDate: lastAPIcallToDate, waitingListDelegate: self, reportStatus: testMenuName) childViewControllers.append(childView) } return childViewControllers }