简体   繁体   English

alamofire抱怨参数类型

[英]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.

相关问题 Alamofire抱怨争论类型 - Alamofire complaining about argument types 如何将混合参数类型传递给 Alamofire 请求 - How to pass mixed argument type to Alamofire request 函数 remove(atOffsets:) 只在运行时抱怨错误类型 - Function remove(atOffsets:) complains about wrong type only at runtime 放大架构抱怨,因为参数类型不是“列表”<UserWallet> ?&#39; - Amplify Schema complains because argument type is not 'List<UserWallet>?' Alamofire:无法使用类型为“(Method,NSURL)”的参数列表调用“ URLRequest” - Alamofire: Cannot invoke 'URLRequest' with an argument list of type '(Method, NSURL)' 无法使用“((Any))”类型的参数列表调用“JSON” - 使用 AlamoFire 和 SwiftyJSON - Cannot invoke 'JSON' with an argument list of type '((Any))' - Using AlamoFire & SwiftyJSON SwiftyJSON Alamofire无法调用类型为((_,_,_,_))-&gt; _)的参数列表的responseJSON - SwiftyJSON Alamofire Cannot invoke responseJSON with an argument list of type ((_,_,_,_))->_) 斯威夫特抱怨“无关的争论标签” - Swift complains “extraneous argument label” Alamofire 的 Codables 错误“无法将 '[String: Any]' 类型的值转换为预期的参数类型 'Data'” - Codables error with Alamofire “Cannot convert value of type '[String : Any]' to expected argument type 'Data'” 无法将类型[[String:任何]]的值转换为预期的参数类型&#39;数据&#39;Alamofire-可编码 - Cannot convert value of type '[String : Any]' to expected argument type 'Data' Alamofire - Codable
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM