0

I have searched many questions similar to the one I want, but cannot find the answer. My syntax are different to the other answers out there and cannot figure it out. I have moved to Swift 3 and after updating my Alamofire cocopod to 4.3 I am getting the error:

Extra Argument in call

This is the code I am getting it on:

request = Alamofire.request(.GET, post.imageURL!).validate(contentType: ["image/*"]).response(completionHandler: { (request, response, data, err) in

Can somebody show me the new code for this?

Henry Brown
  • 2,219
  • 8
  • 31
  • 48
  • Have you looked at the [Alamofire 4.0 migration guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%204.0%20Migration%20Guide.md)? See e.g. the section _Response Serializers_; quoting: _"The response API returned 4 parameters instead of an encapsulating Response type."_. As in this [similar Q&A](http://stackoverflow.com/questions/41447819/) (one of the) the particular issue(s) above is your old usage of the response (completion handler): this now encapsulates a single parameter (not 4). – dfrib Feb 17 '17 at 15:51

1 Answers1

0

The answer was this in the end:

request = Alamofire.request(post.profileImage!).validate(contentType: ["image/*"])
                    .response { response in

                        if response.error == nil {
                        let image = UIImage(data: response.data!)!

I hope this helps somebody. :)

Henry Brown
  • 2,219
  • 8
  • 31
  • 48