Swift3 URLSession.shared.dataTask(…)不';行不通
我找不到任何解决办法,你能帮我Swift3 URLSession.shared.dataTask(…)不';行不通,swift3,xcode8,nsurlsession,shared,Swift3,Xcode8,Nsurlsession,Shared,我找不到任何解决办法,你能帮我 override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: cellId, for: indexPath) let user = users[indexPath.row]
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
}
(Swift 3)编译器需要本机URL
(不带NS
)
let url = URL(string: profileImageURL)