如何使用 Alamofire 像 Postman 一样发送表单数据

Moh*_*din 3 ios postman swift alamofire

我想发出与截屏中显示的 Postman 请求类似的 ALamofire 请求

我结束了 POST + Alamofire UPload + appendBodyPart(#stream: NSInputStream, length: UInt64, headers: [String: String])

将是答案但没有找到明确的例子如何实现它?

我确实检查了这个文档。

邮递员截图

EI *_*2.0 5

您使用 Alamofire 的简单 POST 请求应该是这样的

    Alamofire.request(.POST, "http:/request.example.com", parameters: ["foo": "bar","key_1":"value_1"])
     .response { request, response, data, error in
          println(request)
          println(response)
          println(error)
      }
Run Code Online (Sandbox Code Playgroud)

您可以使用.responseJSON.responseString根据你的回应