我想将我的响应从 NSHTTPURLResponse 类型转换为字符串:
let task = session.dataTaskWithRequest(request, completionHandler: {(data, response, error) -> Void in
println("Response: \(response)")
var responseText: String = String(data: response, encoding: NSUTF8StringEncoding)
})
下面的行将响应消息输出到控制台。
println("Response: \(response)")
但是这一行给我一个错误:Extra argument 'encoding' in Call.
var responseText: String = String(data: response, encoding: NSUTF8StringEncoding)
如何成功地将这个“响应”转换为字符串?