【发布时间】:2014-09-30 20:25:55
【问题描述】:
我正在尝试在我的 TableView 应用程序中实现拉动刷新功能。但是,当我运行该应用程序时,它会在我下拉刷新页面时立即崩溃。我在控制台中收到以下消息:
2014-09-30 21:13:15.799 SimpleText[2031:601545] 17545849:_UIScreenEdgePanRecognizerEdgeSettings.edgeRegionSize=13.000000
2014-09-30 21:13:45.296 SimpleText[2031:601545] -[SimpleText.TimelineTableViewController loadData:]: unrecognized selector sent to instance 0x14d50d5e0
2014-09-30 21:13:45.300 SimpleText[2031:601545] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SimpleText.TimelineTableViewControllerloadData:]: unrecognized selector sent to instance 0x14d50d5e0'
*** First throw call stack:
(0x189402084 0x198fb40e4 0x189409094 0x189405e48 0x18930b08c 0x18da6cb98 0x18da55dd8 0x18dba6834 0x100869158 0x100869118 0x100872320 0x100869118 0x10087cae4 0x10086af7c 0x10086cec8 0x1893b98dc 0x1893b7984 0x1892e5664 0x1923175a4 0x18da9e164 0x1001128b0 0x1001129bc 0x19962aa08)
libc++abi.dylib: terminating with uncaught exception of type NSException
这让我很困惑,因为我不认为错误处理是 swift 的一部分,但它告诉我异常没有被捕获?
这是我的刷新代码的样子:
override func viewDidLoad() {
super.viewDidLoad()
refreshControl = UIRefreshControl()
refreshControl!.attributedTitle = NSAttributedString(string: "Pull to refresh")
refreshControl!.addTarget(self, action: "loadData:", forControlEvents: UIControlEvents.ValueChanged)
self.tableView.addSubview(refreshControl!)
//refresh posts when app is loaded
self.loadData()
}
【问题讨论】: