0
我从Swift3/Alamofire4迁移,需要把所有的元素“作为AnyObject”为[字符串:AnyObject]
parameters = ["name":name, "description":description, "location":location, "start_time":start_time , "end_time":end_time/* ..etc */] as [String: AnyObject]
Alamofire.request(.PUT, url, parameters: parameters, encoding: .json, headers: ["Authorization": auth_token, AppVersionKey: AppVersionValue]).validate().responseJSON() { response in
print("Status code of default pic call: \(response.response?.statusCode)")
}
之前工作得很好以前斯威夫特/ Alamofire版本的旧代码,我知道我现在有将其切换到
Alamofire.request(url, method: .put, ... , encoding: JSONEncoding.default ...)
但我发现了错误的Xcode为parameters
和修复,它只是在K添加as AnyObject
到每个值,v对,然后导致“表达过于复杂是在合理的时间内解决......”的错误。我怎么用新的Swift3和Alamofire4做到这一点?甚至不知道这是否是一个错误雨燕或Alamofire移民问题
的可能的复制[Alamofire参数只接受\ [字符串:Anyobject \]](http://stackoverflow.com/questions/31733630/alamofire-parameter-only-accepts-string-anyobject) – dirtydanee