Crash: Inline date picker row following alert presentation. Attempted to scroll the table view to an out-of-bounds row
robmaceachern opened this issue · 0 comments
robmaceachern commented
Steps:
- Open the SwiftExample project in this repo
- Select Date & Time
- Tap the Countdown Timer row in the INLINE DATES section to expand the picker
- Scroll down to the DATEPICKER section and select a new date
- Tap "OK" on the alert
- Scroll back up to the Countdown Timer row
Expected:
- Countdown Timer row should display
Actual:
- App crashes before displaying the Countdown Timer row.
Thread 1: Exception: "Attempted to scroll the table view to an out-of-bounds row (4) when there are only 4 rows in section 0. Table view: <UITableView: 0x7fc7fb838600; frame = (0 0; 320 568); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x60000316a550>; layer = <CALayer: 0x600003f60440>; contentOffset: {0, 183.33333333333334}; contentSize: {320, 923.33333587646484}; adjustedContentInset: {64, 0, 0, 0}; dataSource: <SwiftExample.DatesFormViewController: 0x7fc7f95178e0>>"
#0 0x00007fff23e3de5e in __exceptionPreprocess ()
#1 0x00007fff512539b2 in objc_exception_throw ()
#2 0x00007fff23e3dcac in +[NSException raise:format:] ()
#3 0x00007fff4951cb73 in -[UITableView _contentOffsetForScrollingToRowAtIndexPath:atScrollPosition:usingPresentationValues:] ()
#4 0x00007fff4951d6dc in -[UITableView _scrollToRowAtIndexPath:atScrollPosition:animated:usingPresentationValues:] ()
#5 0x00007fff4951d58c in -[UITableView scrollToRowAtIndexPath:atScrollPosition:animated:] ()
#6 0x000000010ef60f97 in -[XLFormViewController ensureRowIsVisible:] at /Users/rob/Downloads/XLForm-master/XLForm/XL/Controllers/XLFormViewController.m:464
#7 0x000000010ef26161 in -[XLFormDateCell becomeFirstResponder] at /Users/rob/Downloads/XLForm-master/XLForm/XL/Cell/XLFormDateCell.m:85
#8 0x00007fff49816d94 in -[UIView(Hierarchy) deferredBecomeFirstResponder] ()
#9 0x00007fff49816e38 in -[UIView(Hierarchy) _promoteSelfOrDescendantToFirstResponderIfNecessary] ()
#10 0x00007fff498172fa in __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke ()
#11 0x00007fff25ac3778 in -[NSISEngine withBehaviors:performModifications:] ()
#12 0x00007fff498171b5 in -[UIView(Hierarchy) _postMovedFromSuperview:] ()
#13 0x00007fff49826730 in -[UIView(Internal) _addSubview:positioned:relativeTo:] ()
#14 0x00007fff495093d6 in -[UITableView _addSubview:positioned:relativeTo:] ()
#15 0x00007fff497b8dab in -[UIScrollView _addContentSubview:atBack:] ()
#16 0x00007fff49509124 in -[UITableView _addContentSubview:atBack:] ()
#17 0x00007fff4952c3d1 in __53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke ()
#18 0x00007fff4981f654 in +[UIView(Animation) performWithoutAnimation:] ()
#19 0x00007fff4952bb77 in -[UITableView _configureCellForDisplay:forIndexPath:] ()
#20 0x00007fff4953decf in -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] ()
#21 0x00007fff4950740a in -[UITableView _updateVisibleCellsNow:] ()
#22 0x00007fff4952724e in -[UITableView layoutSubviews] ()
#23 0x00007fff4982d5f4 in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] ()
#24 0x00007fff2b4e9260 in -[CALayer layoutSublayers] ()
#25 0x00007fff2b4ef3eb in CA::Layer::layout_if_needed(CA::Transaction*) ()
#26 0x00007fff2b4faa8a in CA::Layer::layout_and_display_if_needed(CA::Transaction*) ()
#27 0x00007fff2b443a7c in CA::Context::commit_transaction(CA::Transaction*, double) ()
#28 0x00007fff2b477467 in CA::Transaction::commit() ()
#29 0x00007fff2b477df9 in CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) ()
#30 0x00007fff23da1087 in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#31 0x00007fff23d9bb3e in __CFRunLoopDoObservers ()
#32 0x00007fff23d9c08a in __CFRunLoopRun ()
#33 0x00007fff23d9b8a4 in CFRunLoopRunSpecific ()
#34 0x00007fff38c39bbe in GSEventRunModal ()
#35 0x00007fff49325968 in UIApplicationMain ()
#36 0x000000010eeff39b in main at /Users/rob/Downloads/XLForm-master/Examples/Swift/SwiftExample/AppDelegate.swift:12
#37 0x00007fff520ce1fd in start ()
Notes:
- Reproduced with Xcode 11, iOS 13.6.
- The same category of issue is plaguing our app. Somehow the table datasource is getting out of sync when an expanded picker is scrolled off screen, followed by an alert presentation.
- I've also seen instances where the expanded picker is not in the last row of the section and the same steps cause the last row of the section to not appear (though I can't reproduce that issue in the sample app).
- @mats-claassen any support you can offer would be greatly appreciated 🙏