[英]tableView.reloadData() error: Ambiguous reference to member
I'm trying to reload the data in my table once a successful GET request has been performed. 成功执行GET请求后,我正尝试在表中重新加载数据。 However I was thrown this error when I wrote self.tableView.reloadData() :
但是当我写self.tableView.reloadData()时,我被抛出了这个错误:
Ambiguous reference to member 'tableView(_:numberOfRowsInSection:)'
对成员'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 这是完整代码https://codeshare.io/eMqIx的链接
How can I fix this error? 如何解决此错误?
You don't have an outlet called tableView
. 您没有名为
tableView
的出口。 Create one, connect it to Interface Builder and you should be fine. 创建一个,将其连接到Interface Builder,就可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.