我想使用Alamofire向Mailgun发送电子邮件。我正在使用以下代码发送请求,但我从"<function {0} at {1}>".format(foo.__name__, hex(id(foo)))
开始收到错误Cannot call value of non-function type 'HTTPURLResponse?'
。
我该如何解决这个问题?我正在尝试复制此处找到的代码,但为Swift 3更新它。我正在尝试使用Mailgun和Alamofire发送电子邮件。
https://gist.github.com/makzan/11e8605f85352abf8dc1/
谢谢!
.response
答案 0 :(得分:1)
值得看一下这些问题的Alamofire migration pages。
您会看到现在处理的响应如下:
// Alamofire 3
Alamofire.request(.GET, urlString).response { request, response, data, error in
print(request)
print(response)
print(data)
print(error)
}
// Alamofire 4
Alamofire.request(urlString).response { response in // method defaults to `.get`
debugPrint(response)
}