tableView.reloadData() error: Ambiguous reference to member

旧街凉风 提交于 2019-12-11 02:08:54

问题


I'm trying to reload the data in my table once a successful GET request has been performed. However I was thrown this error when I wrote self.tableView.reloadData():

Ambiguous reference to member 'tableView(_:numberOfRowsInSection:)'

This is the affected code

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()

    let url = "http://api.myawesomeapp.com"
    Alamofire.request(.GET, url).validate().responseJSON { response in
        switch response.result {
        case .Success(let data):
            let json = JSON(data)
            if let data = json["name"].arrayValue as [JSON]?{
                self.datas = data
                self.tableView.reloadData()
            }
        case .Failure(let error):
            print("Request failed with error: \(error)")
        }
    }

}

This is a link to the full code https://codeshare.io/eMqIx

How can I fix this error?


回答1:


You don't have an outlet called tableView. Create one, connect it to Interface Builder and you should be fine.



来源:https://stackoverflow.com/questions/37152014/tableview-reloaddata-error-ambiguous-reference-to-member

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!