当我在使用这种方法之前使用 AFNetworking 时
webviewMain.loadRequest(request, MIMEType: mimeType, textEncodingName: textEncoding, progress: { [weak self] (bytesWritten, totalBytesWritten, totalBytesExpectedToWrite) -> Void in
let progress = Float(totalBytesWritten) / Float(totalBytesExpectedToWrite)
self?.progressView.progress = progress
}, success: { (responce, data) -> NSData? in
return data
}) { [weak self] (error) -> Void in
}
但现在我看到编译错误Cannot convert value of type '(_, _, _) -> Void' to expected argument type 'AutoreleasingUnsafeMutablePointer<NSProgress?>' (aka 'AutoreleasingUnsafeMutablePointer<Optional<NSProgress>>')
据我了解,我需要用 NSPredicate 变量替换进度块。如果是这样,我不明白如何跟踪进度。
我需要改变什么?