我遇到了一些麻烦。查看下面的代码部分:
// Create a datatask and pass in the request
let dataTask = session.dataTask(with: request, completionHandler: { (data:NSData?, response:URLResponse?, error:Error?) in
// Get a reference to the image view element of the cell
let imageView = cell.viewWithTag(1) as! UIImageView
// Create an image onject from the data and assign it into the ImageView
imageView.image = UIImage(data: data!)
})
我怎样才能解决这个问题?提前致谢!
由于一些评论,我有一个答案!我将“请求”从 NSURLRequest 更改为 URLRequest,并将代码更新为:
// Create a datatask and pass in the request
let dataTask = session.dataTask(with: request, completionHandler: { (data, response, error) in
// Get a reference to the image view element of the cell
let imageView = cell.viewWithTag(1) as! UIImageView
// Create an image onject from the data and assign it into the ImageView
imageView.image = UIImage(data: data!)
})
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句