【问题标题】:Pull to refresh throwing this error拉动刷新抛出此错误
【发布时间】:2016-04-30 18:38:18
【问题描述】:

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

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 异常预处理 + 165 1 libobjc.A.dylib 0x000000010f89adeb objc_exception_throw + 48 2核心基础0x000000010db6348d-[NSObject(NSObject)不识别选择器:]+205 3 核心基础 0x000000010dab090a ___forwarding_ + 970 4 核心基础 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:withEvent:] + 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 核心基础 0x000000010dabad09 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9 18 核心基础 0x000000010da7c2c9 __CFRunLoopRun + 2073 19 核心基础 0x000000010da7b828 CFRunLoopRunSpecific + 488 20 图形服务 0x0000000111a38ad2 GSEventRunModal + 161 21 UIKit 0x000000010e377610 UIApplicationMain + 171 22 ClipCloud2016Beta 0x000000010d81925d 主要 + 109 23 libdyld.dylib 0x0000000110ae292d 开始 + 1 24 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib:以 NSException 类型的未捕获异常终止 (lldb)

我在 UITableview 的 storyboard 中启用了刷新

ViewDidLoad()中实现了以下内容

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

这是我的刷新方法:

    func handleRefresh(refreshControl: UIRefreshControl) {


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

self.tableView.reloadData() 这行代码在我的代码中的其他地方工作毫无价值。

当发生错误时,Xcode 最终会出现在我的 AppDelegate 类中,这也可能一文不值

class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {

【问题讨论】:

  • HandleRefresh vs handleRefresh - 一个定时器大写首字母,一个小写首字母。
  • 谢谢@luk2302,如果你愿意的话,我还有一个问题,我在我的个人资料中遇到了问题:)

标签: ios swift uitableview refresh


【解决方案1】:

评论者解决的问题

方法和调用之间的 HandleRefresh 与 handleRefresh 拼写错误。

【讨论】:

    【解决方案2】:

    这个固定我的:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-01-04
      • 1970-01-01
      • 2012-10-28
      • 2019-07-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多