alamofire 抱怨参数类型

alamofire complains about argument type

我正在使用 alamofire 主分支。

我按照git页面官方教程写的如下代码。

我的代码是这样的:

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)
        }
    }
}

但是编译器抱怨:

"Cannot invoke 'response' with an argument list of type '((_, _, _, _) -> _)"

所以,有什么想法吗?谢谢。

您在 Alamofire.download 方法的闭包中缺少 destination 参数。