我找不到任何解决方案,请你帮帮我......
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: cellId, for: indexPath)
let user = users[indexPath.row]
cell.textLabel?.text = user.name
cell.imageView?.image = UIImage(named: "lukas")
if let profileImageURL = user.profileImageURL {
var url = NSURL(string: profileImageURL)
URLSession.shared.dataTask(with: url!, completionHandler: { (data, response, error) in
if error != nil {
print(error)
return
}
})
}
return cell
}
答案 0 :(得分:0)
(Swift 3)编译器需要原生URL
(不含NS
)
let url = URL(string: profileImageURL)