0
我得到的错误斯威夫特无法调用与类型的参数添加(名称:字符串,字符串)
斯威夫特无法调用与类型的参数附加:
。我已(名称字符串,字符串)我的代码的一部分在这里。
func gotData(result:NSDictionary){
if result.count == 0{
print("data is nil")
}else{
if result["Search"] == nil{
print("no results found")
Global.showAlert("No Movie Found", message: "Double check the name", view: self)
}else{
var results = result["Search"] as! [NSDictionary]
for result in results as [NSDictionary]{
var name = result["Title"] as! String
var year = result["Year"] as! String
var imdbID = result["imdbID"] as! String
self.movieList.append(name:"\(name), (\(year))", imdbID:"\(imdbID)")
}
tableView.reloadData()
}
}
}
错误发生在这条线
self.movieList.append(name:"\(name), (\(year))", imdbID:"\(imdbID)")
人对如何解决这一问题的任何想法?
可能是这样的? http://stackoverflow.com/questions/32654654/swift-2-array-of-tuples-not-working-as-in-swift-1(只是一个猜测) – Moritz
什么是self.movieList的元素类型? –
@EricD。似乎工作。我不知道为什么,但它确实如此。那很好。谢谢。 – Niclas