Home Articles

拉动刷新抛出此错误

Asked
Viewed 1311 times
0

我正在尝试在我的 Cloud 套件笔记应用程序中实现pull刷新,但是当我下拉以运行刷新时,我收到以下错误:

2016-01-24 12:36:01.078 ClipCloud2016Beta [13325:521249] - [ClipCloud2016Beta.MasterViewController HandleRefresh:]:无法识别的选择器发送到实例0x7fd77b4612f0 2016-01-24 12:36:01.084 ClipCloud2016Beta [13325:521249] *终止应用程序由于未捕获的异常'NSInvalidArgumentException',原因:' - [ClipCloud2016Beta.MasterViewController HandleRefresh:]:无法识别的选择器发送到实例0x7fd77b4612f0'*第一次抛出调用堆栈:(0 CoreFoundation 0x000000010db5ae65 exceptionPreprocess 165 1 libobjc.A.dylib 0x000000010f89adeb objc_exception_throw 48 2 CoreFoundation 0x000000010db6348d - [NSObject(NSObject)doesNotRecognizeSelector:] 205 3 CoreFoundation 0x000000010dab090a __forwarding 970 4 CoreFoundation 0x000000010dab04b8 _CF_forwarding_prep_0 120 5 UIKit 0x000000010e379194 - [UIApplication sendAction:to:from:forEvent:] 92 6 UIKit 0x000000010e4e86fc - [UIControl sendAction:to:forEvent: ] 67 7 UIKit 0x000000010e4e89c8 - [UIControl _sendActionsForEvents:withEv ENT:] 311 8的UIKit 0x000000010ececc0b - [UIRefreshControl _setRefreshControlState:通知:] 456 9的UIKit 0x000000010ecf4ec3 52 - [_ UIRefreshControlModernContentView _snappingMagic] _block_invoke 57 10 libdispatch.dylib 0x0000000110a8de5d _dispatch_call_block_and_release 12 11 libdispatch.dylib 0x0000000110aae49b _dispatch_client_callout 8 12 libdispatch.dylib 0x0000000110a93746 _dispatch_after_timer_callback 334 13 libdispatch名为.dylib 0x0000000110aae49b _dispatch_client_callout 8 14 libdispatch.dylib 0x0000000110aa18a5 _dispatch_source_latch_and_call 1750 15 libdispatch.dylib 0x0000000110a9c830 _dispatch_source_invoke 1057个16 libdispatch.dylib 0x0000000110a96111 _dispatch_main_queue_callback_4CF 1324 17的CoreFoundation 0x000000010dabad09 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE 9 18的CoreFoundation 0x000000010da7c2c9 __CFRunLoopRun 2073 19的CoreFoundation 0x000000010da7b828 CFRunLoopRunSpecific 488个20 GraphicsServices 0x0000000111a38ad2 GSEventRunModal 161 21 UI套件0x000000010e377610 UIApplicationMain 171 22 ClipCloud2016Beta 0x000000010d81925d main 109 23 libdyld.dylib 0x0000000110ae292d start 1 24 ??? 0x0000000000000001 0x0 1)libc abi.dylib:以NSException类型的未捕获异常终止(lldb)

我在UITableview的故事板中启用了Refresh

ViewDidLoad() 中实现了以下内容

self.refreshControl?.addTarget(self, action: "HandleRefresh:", forControlEvents: UIControlEvents.ValueChanged)

这是我的刷新方法:

func handleRefresh(refreshControl: UIRefreshControl) {


    self.tableView.reloadData()
    refreshControl.endRefreshing()
}

在我的代码中, self.tableView.reloadData() 行在其他地方工作是没有 Value 的 .

当错误发生时Xcode最终会在我的AppDelegate类中结束

class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {

2 Answers

  • 1

    问题由评论者解决

    HandleRefresh vs handleRefresh方法和调用之间的拼写错误 .

  • 0

    这个固定的矿:

    refreshControl.addTarget(self, action:
            #selector(ViewController.HandleRefresh(sender:)),
                                 for: UIControlEvents.valueChanged)
    

Related