0
我遇到了一些麻烦。看看代码波纹管的这一部分:dataTask错误 - “无法用类型参数列表调用'dataTask'”
// 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!)
})
我该如何解决这个问题?提前致谢!
尝试改变'(数据:NSData的?,响应:URLResponse ?,错误:错误)''到数据,响应,错误'。 – OOPer
@OOPer好吧,所以这里是更新后的代码let dataTask = session.dataTask(with:request,completionHandler:{(data,response,error)现在我得到一个错误 - 对成员dataTask的模糊引用(with:completionHandler) ' – iFunnyVlogger
@iFunnyVlogger你需要使用'URLRequest'而不是'NSURLRequest' –