Missing cell for newly visible row

We have never seen such exception before, can someone let us know what's the problem is and what is the solution for it ?


callstack from the crash report


0
CoreFoundation
__exceptionPreprocess
1 libobjc.A.dylib
objc_exception_throw
2 CoreFoundation
+[NSException raise:format:]
3 Foundation
-[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
4 UIKit
__46-[UITableView _updateWithItems:updateSupport:]_block_invoke.972
5 UIKit
+[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:]
6 UIKit
+[UIView(UIViewAnimationWithBlocks) animateWithDuration:delay:options:animations:completion:]
7 UIKit
-[UITableView _updateWithItems:updateSupport:]
8 UIKit
-[UITableView _endCellAnimationsWithContext:]
9
UIKit
-[UITableView _updateRowsAtIndexPaths:updateAction:withRowAnimation:]

Replies

Happend to me too. It appears to be reproduced after lots of tableView insertions and/or rows updates. After some insertion or rows update, get this error. Reproduces only on iOS 10 beta. Previous versions work fine

this tag saved ???????

I'm also getting this error when I run in the simulator.


No crash when running on a device.


my setup:

Xcode 8.0 (8A218a)

simulator: iPhone 5s - iOS 10.0 (14A345)




call stack

2016-10-02 16:30:34.814 Helium[57037:2457872] *** Assertion failure in -[SwiftyFORM.FormTableView _updateWithItems:updateSupport:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3599.6/UITableView.m:3149
2016-10-02 16:30:34.830 Helium[57037:2457872] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Missing cell for newly visible row 1'
*** First throw call stack:
(
  0   CoreFoundation                      0x00000001099e634b __exceptionPreprocess + 171
  1   libobjc.A.dylib                     0x000000010944721e objc_exception_throw + 48
  2   CoreFoundation                      0x00000001099ea442 +[NSException raise:format:arguments:] + 98
  3   Foundation                          0x0000000108fddedd -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
  4   UIKit                               0x000000010780751c __46-[UITableView _updateWithItems:updateSupport:]_block_invoke.996 + 445
  5   UIKit                               0x000000010777ae61 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 581
  6   UIKit                               0x000000010777b368 +[UIView(UIViewAnimationWithBlocks) animateWithDuration:delay:options:animations:completion:] + 105
  7   UIKit                               0x0000000107806ffa -[UITableView _updateWithItems:updateSupport:] + 4426
  8   UIKit                               0x00000001077feec3 -[UITableView _endCellAnimationsWithContext:] + 17960
  9   SwiftyFORM                          0x0000000106afab5b _TZFV10SwiftyFORM20ToggleExpandCollapse7executefT10toggleCellCSo15UITableViewCell12expandedCellS1_9tableViewCSo11UITableView12sectionArrayCS_21TableViewSectionArray_T_ + 2603
  10  SwiftyFORM                          0x0000000106a87f65 _TFC10SwiftyFORM20PickerViewToggleCell20toggleExpandCollapsefT_T_ + 469
  11  SwiftyFORM                          0x0000000106a8806f _TFC10SwiftyFORM20PickerViewToggleCell6expandfT_T_ + 95
  12  SwiftyFORM                          0x0000000106a8798c _TFC10SwiftyFORM20PickerViewToggleCell20becomeFirstResponderfT_Sb + 124
  13  SwiftyFORM                          0x0000000106a8779f _TFC10SwiftyFORM20PickerViewToggleCell17form_didSelectRowfT9indexPathV10Foundation9IndexPath9tableViewCSo11UITableView_T_ + 191
  14  SwiftyFORM                          0x0000000106a88886 _TTWC10SwiftyFORM20PickerViewToggleCellS_17SelectRowDelegateS_FS1_17form_didSelectRowfT9indexPathV10Foundation9IndexPath9tableViewCSo11UITableView_T_ + 86
  15  SwiftyFORM                          0x0000000106adc5a3 _TFC10SwiftyFORM16TableViewSection9tableViewfTCSo11UITableView14didSelectRowAtV10Foundation9IndexPath_T_ + 467
  16  SwiftyFORM                          0x0000000106adea63 _TFC10SwiftyFORM21TableViewSectionArray9tableViewfTCSo11UITableView14didSelectRowAtV10Foundation9IndexPath_T_ + 179
  17  SwiftyFORM                          0x0000000106adeae7 _TToFC10SwiftyFORM21TableViewSectionArray9tableViewfTCSo11UITableView14didSelectRowAtV10Foundation9IndexPath_T_ + 87
  18  UIKit                               0x000000010781796d -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1848
  19  UIKit                               0x0000000107817b81 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 330
  20  UIKit                               0x00000001076cd8bb _runAfterCACommitDeferredBlocks + 320
  21  UIKit                               0x00000001076ba53f _cleanUpAfterCAFlushAndRunDeferredBlocks + 566
  22  UIKit                               0x00000001076eb7ce _afterCACommitHandler + 176
  23  CoreFoundation                      0x000000010998ae17 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
  24  CoreFoundation                      0x000000010998ad87 __CFRunLoopDoObservers + 391
  25  CoreFoundation                      0x000000010996fb9e __CFRunLoopRun + 1198
  26  CoreFoundation                      0x000000010996f494 CFRunLoopRunSpecific + 420
  27  GraphicsServices                    0x000000010ddfda6f GSEventRunModal + 161
  28  UIKit                               0x00000001076c0f34 UIApplicationMain + 159
  29  Helium                              0x000000010628154f main + 111
  30  libdyld.dylib                       0x000000010c6c668d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Happened to me too.


This happens when I delete a row.


Steps to reproduce

- Add rows

- Delete rows, specifically making sure there's some rows outside the current screen (that will then be in screen when the deletion is successful

- Repeat until crash occurs


It doesn't always happen so my best guess is that it will happen only when the cells it's trying to load get recycled


This is in 10.0 simulator with Xcode 8.0


2016-10-20 15:55:19.862 ***[48525:4879408] *** Assertion failure in -[UITableView _updateWithItems:updateSupport:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3599.6/UITableView.m:3149

2016-10-20 15:55:19.878 ***[48525:4879408] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Missing cell for newly visible row 5'

I replied to this yesterday, happened to me too .


(my previous post is "being moderated"... takes a while?)

+1

I'm still having this problem with Xcode8.1

Worked fine before iOS10.

In my case this happened after insertRows with a negative row number.

I'm also experiencing this issue. Haven't figured out the solution yet, But for now, I use a try-catch block and remember to endUpdates within the catch block, otherwise the reloadData won't do anything. Hope it helps!


@try { 
    [self.tableView beginUpdates]; 
    //try with nil to go to catch block 
    [self.tableView insertRowsAtIndexPaths:nil withRowAnimation:UITableViewRowAnimationBottom]; 
    [self.tableView endUpdates]; 
} 
@catch (NSException * e) { 
     [self.tableView endUpdates]; 
     dispatch_async(dispatch_get_main_queue(), ^{ 
     [self.tableView reloadData]; 
     }); 
}

Did you figure out how to fix this? thx