终止应用程序由于未捕获的异常“NSInvalidArgumentException”,原因是:无法识别的选择发送到实例0x1559a8200
错误引用的选择信息是:
[SoloCheck.DirectorFormCell seeDirectorReportDidTap:]
的代码添加目标如下:
cell.seeDirectorReport.addTarget(cell.seeDirectorReport, action: #selector(CompanyFreeReportVC.seeDirectorReportDidTap(_:)), forControlEvents: .TouchUpInside)
该法的执行情况如下:
func seeDirectorReportDidTap(sender: UIButton) {
self.performSegueWithIdentifier("OpenCompanyDocumentsSegue", sender: sender.tag)
}
我改变了代码
cell.seeDirectorReport.addTarget(self, action: #selector(CompanyFreeReportVC.seeDirectorReportDidTap(_:)), forControlEvents: .TouchUpInside)
和误差保持不变:
2017-04-20 15:53:19.806 SoloCheck[12035:1267396] Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UISearchController: 0x15ef187a0>)
2017-04-20 15:53:19.854 SoloCheck[12035:] <GMR/INFO> App measurement v.2003000 started
2017-04-20 15:53:19.854 SoloCheck[12035:] <GMR/INFO> To enable debug logging set the following application argument: -GMRDebugEnabled (see)
2017-04-20 15:53:20.009 SoloCheck[12035:1267396] [Crashlytics] Version 3.7.0 (102)
2017-04-20 15:53:37.786 SoloCheck[12035:1267396] -[SoloCheck.DirectorFormCell seeDirectorReportDidTap:]: unrecognized selector sent to instance 0x15f154600
2017-04-20 15:53:37.794 SoloCheck[12035:1267396] WARNING: GoogleAnalytics 3.14 void GAIUncaughtExceptionHandler(NSException *) (GAIUncaughtExceptionHandler.m:48): Uncaught exception: -[SoloCheck.DirectorFormCell seeDirectorReportDidTap:]: unrecognized selector sent to instance 0x15f154600
2017-04-20 15:53:42.837 SoloCheck[12035:1267396] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SoloCheck.DirectorFormCell seeDirectorReportDidTap:]: unrecognized selector sent to instance 0x15f154600'
*** First throw call stack:
(0x18324d900 0x1828bbf80 0x18325461c 0x1832515b8 0x18315568c 0x187f77e50 0x187f77dcc 0x187f5fa88 0x187f776e4 0x187f30294 0x187f70820 0x187f6fe1c 0x187f404cc 0x187f3e794 0x183204efc 0x183204990 0x183202690 0x183131680 0x184640088 0x187fa8d90 0x1000b544c 0x182cd28b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
什么是无法识别的选择器,它通常是在错误消息 – Alistra
[SoloCheck.DirectorFormCell seeDirectorReportDidTap:] - 我也想把一个值放在button标记中,并在seeDirectorReportDidTap方法中检索是否有可能? –
你的'#selector'指定了一个视图控制器的方法,但'target'似乎是别的。 “cell.seeDirectReport”引用了什么? – Rob