Alamofire 4.0.0:[String:String]不能转换为[String:Any]&没有更多上下文,请求是模糊的

时间:2016-08-23 10:34:57

标签: ios swift nsdictionary alamofire swift3

我正在将Alamofire更新为4.0.0 Beta 1,将XCode 8更新为Beta 6.首先,此代码出现[String:String] is not convertible to [String : Any]错误

let parameter = [
        "scope":"\(scope)",
        "client": "\(clientId)"
    ]
Alamofire.request(link, withMethod: .POST, parameters: parameter, encoding: .json).responseJSON

在我将[String:Any]添加到参数后,错误消失了,但创建了新错误:Expression type 'Request' is ambiguous without more context

let parameter:[String:Any] = [
        "scope":"\(scope)",
        "client": "\(clientId)"
    ]

1 个答案:

答案 0 :(得分:0)

.JSON替换为.JSONEncoding.default