问题
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