gpt4 book ai didi

ios - 关闭错误的 Alamofire 上下文类型

转载 作者:行者123 更新时间:2023-11-29 01:07:36 28 4
gpt4 key购买 nike

使用 Swift 2 将 Alamofire 升级到版本 2.0.0.0 后出现以下错误

enter image description here

有人知道解决这个问题的方法吗?

最佳答案

请求序列化,即 responseJson 更改了 AlamoFire 2.0 中的签名。 Migration Guide完整解释,但缩写版本如下。

您现在需要提供一个接受请求响应结果的闭包。结果是一个 enum,它可以是 .Success(Value).Failure(NSData?, ErrorType)

所以你的代码应该是这样的:

Alamofire.request(.GET, urlString, parameters: params, encoding: .URL)
.responseJson(options: .MutableContainers) { (request, response, result) -> Void in
print(result)
}

关于ios - 关闭错误的 Alamofire 上下文类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36154703/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com