I have two pages, each with a tableView in them. The first tableview leads to the second tableView when a cell is pressed via a push segue. I used "embed in" to apply a navigation controller to the first view controller which gives the second view a back button which works for 99% of the application. For some reason, if I scroll all the way down to the bottom of the second tableview and then press the back button, the application crashes with this error: Thread 1: EXC_BAD_ACCESS
. The backtrace from the console is this:
(lldb) bt
* thread #1: tid = 0x9517c, 0x000000011115a00b libobjc.A.dylib`objc_msgSend + 11, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: 0x000000011115a00b libobjc.A.dylib`objc_msgSend + 11
frame #1: 0x000000010ff1f462 UIKit`-[UIScrollView(UIScrollViewInternal) _notifyDidScroll] + 56
frame #2: 0x000000010ff0fa42 UIKit`-[UIScrollView setContentOffset:] + 645
frame #3: 0x000000010ff79b5f UIKit`-[UITableView setContentOffset:] + 362
frame #4: 0x000000010ff24360 UIKit`-[UIScrollView(UIScrollViewInternal) _adjustContentOffsetIfNecessary] + 1445
frame #5: 0x000000010ff214ef UIKit`-[UIScrollView(UIScrollViewInternal) _stopScrollingNotify:pin:tramplingDragFlags:] + 417
frame #6: 0x000000010ff102d6 UIKit`-[UIScrollView removeFromSuperview] + 32
frame #7: 0x000000010fee9e39 UIKit`-[UIView dealloc] + 404
frame #8: 0x00000001111588cd libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 591
frame #9: 0x000000010f045da6 CoreFoundation`_CFAutoreleasePoolPop + 22
frame #10: 0x000000010f079ef3 CoreFoundation`__CFRunLoopRun + 2051
frame #11: 0x000000010f079486 CoreFoundation`CFRunLoopRunSpecific + 470
frame #12: 0x0000000113e329f0 GraphicsServices`GSEventRunModal + 161
frame #13: 0x000000010fe8b420 UIKit`UIApplicationMain + 1282
* frame #14: 0x000000010eb9122e appname`top_level_code + 78 at AppDelegate.swift:13
frame #15: 0x000000010eb9126a appname`main + 42 at AppDelegate.swift:0
frame #16: 0x000000011191d145 libdyld.dylib`start + 1
(lldb)
If I scroll slightly up from the bottom of the second tableView, the program does not crash. The way I added the navigation controller was by clicking on the first view controller and using the "embed in" command. When the crash occurs, it takes me to the AppDelegate file as seen here:
What could be causing this program to crash in such a specific manner?