When I pass the parameter that a JSON expects, I get the error that "can not convert value type String to expected argument type JSON" (aka 'Optional Dictionary (String, Any')
this is the data
var params: JSON = ["token": token, "system": "system", "dev": dev]
if let jsonData = try? JSONSerialization.data(withJSONObject: params, option: .prettyPrinted) {
if let jsonString = String.init(data: jsonData, encoding: .ascii) {
and in this function to send the data is where I missed the error in jsonString, in the wait function a JSON object comes as well within the function
APICLient..... params: JSON? = nil...
and I put it in such a way so that I get it as JSON
APICLlient.request(nil, method: .pos, path: .postupdate, params: jsonString) { (response, succees) in
// mas codigo ->
}
}
}
I convert it because it does not execute or send nil in the function since it waits for a JSON but I miss that error ...