Ios UITableViewDelegate崩溃
我有一些视图控制器,里面有Ios UITableViewDelegate崩溃,ios,swift,uitableview,Ios,Swift,Uitableview,我有一些视图控制器,里面有UITableView。它们都有基类-BaseTableViewController BaseTableViewController实现了一些UITableViewDelegate逻辑,因此它也有一些存根委托方法,特别是用于行选择: func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { } 正如您所看到的,它是空方法,所以子类不调用它。 然而Crashlytics
UITableView
。它们都有基类-BaseTableViewController
BaseTableViewController
实现了一些UITableViewDelegate
逻辑,因此它也有一些存根委托方法,特别是用于行选择:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
正如您所看到的,它是空方法,所以子类不调用它。
然而Crashlytics的崩溃报告告诉我这个方法正在崩溃。我自己无法复制它:
#0. Crashed: com.apple.main-thread
0 libswiftCore.dylib 0x100e88a18 _TFs16_assertionFailedFTVs12StaticStringSSS_Su5flagsVs6UInt32_Os5Never + 164
1 MyApp 0x10028ae14 BaseTableViewController.tableView(UITableView, didSelectRowAt : IndexPath) -> () (BaseTableViewController.swift)
2 UIKit 0x190f2bd30 -[UIApplication sendAction:to:from:forEvent:] + 96
3 UIKit 0x190f2bcb0 -[UIControl sendAction:to:forEvent:] + 80
4 UIKit 0x190f16128 -[UIControl _sendActionsForEvents:withEvent:] + 452
5 UIKit 0x190f2b59c -[UIControl touchesEnded:withEvent:] + 584
6 UIKit 0x1914b6628 _UIGestureEnvironmentSortAndSendDelayedTouches + 4484
7 UIKit 0x1914b26c0 _UIGestureEnvironmentUpdate + 1164
8 UIKit 0x1914b21e0 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 408
9 UIKit 0x1914b149c -[UIGestureEnvironment _updateGesturesForEvent:window:] + 268
10 UIKit 0x190f2630c -[UIWindow sendEvent:] + 2960
11 UIKit 0x190ef6da0 -[UIApplication sendEvent:] + 340
12 UIKit 0x1916e075c __dispatchPreprocessedEventFromEventQueue + 2736
13 UIKit 0x1916da130 __handleEventQueue + 784
14 CoreFoundation 0x18afeeb5c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
15 CoreFoundation 0x18afee4a4 __CFRunLoopDoSources0 + 524
16 CoreFoundation 0x18afec0a4 __CFRunLoopRun + 804
17 CoreFoundation 0x18af1a2b8 CFRunLoopRunSpecific + 444
18 GraphicsServices 0x18c9ce198 GSEventRunModal + 180
19 UIKit 0x190f617fc -[UIApplication _run] + 684
20 UIKit 0x190f5c534 UIApplicationMain + 208
21 MyApp 0x100128c30 main (main.m:14)
22 libdispatch.dylib 0x189efd5b8 (Missing)
正如你所看到的,这是一个非常奇怪的报告。首先,不应调用此方法,因为子视图控制器从不调用super.tableView(didSelectRowAt)
。其次,它看起来不像普通的tableView(didSelectRowAt)
call——没有来自tableView的调用,只有对委托方法的直接调用。第三,这个方法是空的,没有什么可崩溃的
我假设存在一些内存问题,因为Crashlytics报告还说:
# RAM Free: 3.3%
# Disk Free: 3.3%
但我不知道这是真的还是假的
你能告诉我如何调试和解决这个问题吗
提前谢谢
PS据报道,这不是一次性的崩溃,它经常发生。什么时候发生的?@John我不知道。这是我所有的线索。我无法复制它。Crashlytics应该指示代码行或其他内容,否则显示did selectcode@John
didSelect
方法为空。那么为什么要实现它呢?如果为空,您也不需要为您的UITableView
设置delegate