【发布时间】:2018-11-30 20:28:59
【问题描述】:
我遇到了一个我没想到会发生的问题。 我需要对只允许这样做的第三方 API 发出 post 请求
let parameters: Parameters = [{
"id": "1",
"original-address": "Some city, Some street"}]
你可以看到它不是字典,所以编译器说Cannot convert value of type '[() -> String]' to specified type 'Parameters' (aka 'Dictionary<String, Any>')
我无法删除括号,因为我的第 3 方 API 不会响应此请求。
如何使用 Alamofire 发送这样的请求?
我已经尝试了我们心爱的 * 的一些建议,但仍然没有成功。
【问题讨论】:
-
Alamofire is arguing你这是什么意思?你试过去掉括号吗? -
@EmilioPelaez 我的意思是编译器抛出错误,描述为
Cannot convert value of type '[() -> String]' to specified type 'Parameters' (aka 'Dictionary<String, Any>')我无法删除括号,因为我的第 3 方 API 不会响应此请求。
标签: ios json swift parameters alamofire