1
它給了我錯誤:無法調用非函數類型'HTTPURLResponse'的值 它應該是由@escaping引起的,但我無法使它在下面的句子中工作。請幫忙,Swift 3.0,AlamofireImage。 還有其他類似的答案,但不能讓他們與我的代碼下面的工作。無法調用非函數類型'HTTPURLResponse的值?
func getNetworkImage(_ urlString: String, completion: @escaping ((UIImage) -> Void)) -> (ImageRequest) {
let queue = decoder.queue.underlyingQueue
let request = Alamofire.request(urlString)
let imageRequest = ImageRequest(request: request)
imageRequest.request.response(
queue: queue,
responseSerializer: Request.imageResponseSerializer(),
completionHandler: { response in
guard let image = response.result.value else {
return
}
let decodeOperation = self.decodeImage(image) { image in
completion(image)
self.cacheImage(image, urlString: urlString)
}
imageRequest.decodeOperation = decodeOperation
}
)
return imageRequest
}
爲什麼downvote? – Darkwonder
謝謝,我會研究它! – Giovanni