一直找解决办法在这找到了
http://stackoverflow.com/questions/27026916/sending-json-array-via-alamofire
大概解释一下:其实就是重新封装一下request。
let array = ["1","1","2"]
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try! JSONSerialization.data(withJSONObject: array)
Alamofire.request(request).validate().responseJSON { (response) in
if response.result.isSuccess
{
print("请求成功:\n\(response.result.value!)")
}els
{
print("\(response.debugDescription)")
}
}