Crash Fatal Exception: NSInternalInconsistencyException UITableView dataSource is not set

Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x1a0b40300 __exceptionPreprocess
1 libobjc.A.dylib 0x1a0854c1c objc_exception_throw
2 CoreFoundation 0x1a0a3d1f8 +[_CFXNotificationTokenRegistration keyCallbacks]
3 Foundation 0x1a0e81998 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
4 UIKitCore 0x1a4e8ae64 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:]
5 UIKitCore 0x1a4e57cc8 -[UITableView _updateVisibleCellsNow:]
6 UIKitCore 0x1a4e74fe0 -[UITableView layoutSubviews]
7 UIKitCore 0x1a515b284 -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
8 QuartzCore 0x1a77aa718 -[CALayer layoutSublayers]
9 QuartzCore 0x1a77aab58 CA::Layer::layout_if_needed(CA::Transaction*)
10 QuartzCore 0x1a77bd03c CA::Layer::layout_and_display_if_needed(CA::Transaction*)
11 QuartzCore 0x1a770195c CA::Context::commit_transaction(CA::Transaction*, double)
12 QuartzCore 0x1a772c4bc CA::Transaction::commit()
13 QuartzCore 0x1a772d0b4 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
14 CoreFoundation 0x1a0abaee8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
15 CoreFoundation 0x1a0ab5b78 __CFRunLoopDoObservers
16 CoreFoundation 0x1a0ab6018 __CFRunLoopRun
17 CoreFoundation 0x1a0ab58f4 CFRunLoopRunSpecific
18 GraphicsServices 0x1aaecc604 GSEventRunModal
19 UIKitCore 0x1a4c89358 UIApplicationMain
20 Maytag 0x102438c98 main + 16 (AdrsStepperView.swift:16)
21 libdyld.dylib 0x1a09312dc start


Getting this log on crash, not able to figure out what is going wrong over here.

That would help to show the code and how you defined the datasource for the tableView.

That should be done:
  • either because the class is defined as UITableViewController

  • or because you defined the dataSource delegate in Interface Builder

  • or with a declaration in the viewDidLoad of the controller

myTable.datasource = self
In this case, you need to have the ViewController to conform to UITableViewDataSource, UITableViewDelegate

Crash Fatal Exception: NSInternalInconsistencyException UITableView dataSource is not set
 
 
Q