我收到错误
Swift无法使用类型(name:String,String)
的参数调用append我在这里附上了部分代码。
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)")
任何人对如何解决这个问题都有任何想法?
答案 0 :(得分:0)
编辑这样的行
self.movieList.append((name:"\(name), (\(year))", imdbID:"\(imdbID)"))
让它发挥作用。谢谢@EricD