Ios 发送到实例[UIView setRefreshControl:]的选择器无法识别

Ios 发送到实例[UIView setRefreshControl:]的选择器无法识别,ios,compiler-errors,storyboard,Ios,Compiler Errors,Storyboard,在多个VCs中使用自定义刷新控制的应用程序。然而,其中只有一个不工作,并抛出了主题错误 自定义UIRefresh控件: class CustRefreshCont: UIRefreshControl { override init() { super.init() let noColor = UIColor.clear let lightGrayColor = UIColor.lightGray self.tintCo

在多个VCs中使用自定义刷新控制的应用程序。然而,其中只有一个不工作,并抛出了主题错误

自定义UIRefresh控件:

class CustRefreshCont: UIRefreshControl {

     override init() {
        super.init()

        let noColor = UIColor.clear
        let lightGrayColor = UIColor.lightGray
        self.tintColor = lightGrayColor
        self.backgroundColor = noColor
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
我检查了其他风投的代码,没有什么不同。我假设这个错误在MainstryBoard(即UIView的检查器)是可以修复的

先谢谢你

编辑:提供了附加代码:

减容:

let refreshControl = CustRefreshCont()
refreshControl.addTarget(self, action: #selector(PortfolioVC.refreshData), for: UIControlEvents.valueChanged)

// if it is iOS 10 and higher run new method
if #available(iOS 10.0, *) {
    tableView.refreshControl = refreshControl
} else {
    tableView.addSubview(refreshControl)
}
功能:

@objc private func refreshData (){
    // Calculate elapsedTime
    elapsedTime = Date().timeIntervalSince(lastRefresh)
    convToInt = refreshRestrictSec - NSInteger(elapsedTime)

    // If last refresh call was older then a minute
    if  NSInteger(elapsedTime) > refreshRestrictSec {

        // Displaying text while updating
        self.refreshControl.attributedTitle = NSAttributedString(string: "Updating data...", attributes: [NSAttributedStringKey.foregroundColor : UIColor.lightGray, NSAttributedStringKey.backgroundColor : UIColor.clear])
        print(elapsedTime)
        view.endEditing(true)
        selectedCurrencies.removeAll()

        // Pulling JSON data and updating selected Currencies
        downloadCurrencies(completion: { (isComp, isErr) in
            if Currencies.count > 0 {
                syncValuesAtStored(cur: selectedCurrencies)
                DispatchQueue.main.async {
                    calculateTotalWorth()
                    excludeNonePosses()
                    self.refreshControl.endRefreshing()
                    animateTableView(tableView: self.tableView)
                    self.collectionView.reloadData()
                    lastRefresh = Date()
                }
            } else {
                print("Error on Refresh")
            }
        })

    } else {
        print(elapsedTime)
        self.refreshControl.attributedTitle = NSAttributedString(string: "You can refresh \(convToInt) seconds later!", attributes: [NSAttributedStringKey.foregroundColor : UIColor.lightGray, NSAttributedStringKey.backgroundColor : UIColor.clear])
        self.refreshControl.endRefreshing()
    }
}

从主板上的相关VC(PortfolioVC)中删除并重新连接tableView的出口后,修复了错误。因此,这一定是xCode的错误。

错误告诉您普通的
UIView
没有
refreshControl
属性,这似乎是正确的。您在代码中遇到此错误的地方发生了什么?(例如,您如何使用子类?)你好,Philip,我通过其他相关代码编辑了这个问题。当应用程序崩溃时,会显示AppDelegate。没有显示我输入的代码行。谢谢。执行此操作时,是否可以通过打印或在调试器中检查来验证
tableView
实际上是什么?如果它是一个表视图控制器,检查它的
视图
属性也是什么。嗨,Philip,在玩过之后,我终于解决了这个问题,并将答案放在下面。非常感谢你的帮助。我很感激。