2017-02-07 27 views
0

我找不到任何解決方案,您可以請幫我...URLSession.shared.dataTask(......)不工作

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 
} 

img

回答

0

的(SWIFT 3)編譯器本地URL(無NS

let url = URL(string: profileImageURL)