[英]alamofire complains about argument type
I'm using alamofire master branch. 我正在使用alamofire主分支。
I write the following code as official tutorial said in the git page. 我按照git页面中的官方教程编写了以下代码。
My code is something like: 我的代码是这样的:
private func startDownLoad() {
Alamofire.download(.GET, REMOTE_TESTSET_URL,
{ (temporaryURL, response) in
if let directoryURL = NSFileManager.defaultManager().URLsForDirectory(
.DocumentDirectory, inDomains: .UserDomainMask)[0] as? NSURL {
let pathComponent = response.suggestedFilename
let fileUrl = directoryURL.URLByAppendingPathComponent(pathComponent!)
if let fullPath = fileUrl.absoluteString {
if NSFileManager.defaultManager().fileExistsAtPath(fullPath) {
NSFileManager.defaultManager().removeItemAtPath(fullPath, error: nil)
}
}
return fileUrl
}
return temporaryURL
}
).progress( closure: { (bytesRead, totalBytesRead, totalBytesExpectedToRead) in
println("download set progress")
self.delegate.onDownLoadProgress(Int(totalBytesRead), total: Int(totalBytesExpectedToRead))
}).response { (request, response, _, error) in
if nil == error {
NSUserDefaults.standardUserDefaults().setValue(self.currentVersion, forKey: KEY_TEST_SET_VERSION)
self.delegate.onDownLoadFinish(STATUS_DOWNLOAD_SUCCESS)
} else {
self.delegate.onDownLoadError(ERROR_UNKNOWN_ERROR)
}
}
}
But the compiler complains: 但是编译器抱怨:
"Cannot invoke 'response' with an argument list of type '((_, _, _, _) -> _)" “无法使用类型为(((_,_,_,_)-> _))的参数列表调用'response'”
so, any ideas? 那么,有什么想法吗? thanks. 谢谢。
您在Alamofire.download
方法的闭包中缺少destination
参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.