Reputation: 954
I have the following error after upgrading Alamofire to version 2.0.0.0 using Swift 2
Anyone know a fix for this?
Upvotes: 0
Views: 219
Reputation: 3947
The Request Serialisation, i.e. responseJson
changed signatures in AlamoFire 2.0. The Migration Guide explains in full, but the abbreviated version is as follows.
You now need to supply a closure which takes a request
, a response
, and a result
. The result is an enum
, which can either be .Success(Value)
or .Failure(NSData?, ErrorType)
.
So your code should look something like this:
Alamofire.request(.GET, urlString, parameters: params, encoding: .URL)
.responseJson(options: .MutableContainers) { (request, response, result) -> Void in
print(result)
}
Upvotes: 1