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