简体   繁体   English

Alamofire请求收到错误消息“通话中的额外参数”

[英]Alamofire request getting error 'Extra Argument in call'

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: 我已移至Swift 3,并将Alamofire cocopod更新为4.3后,出现错误:

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? 有人可以告诉我新的代码吗?

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. 希望对您有所帮助。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM