0
Previously in my app when I made a call to the server and if there was an error I would do the following:
Alamofire.request(mutableURLRequest).responseJSON{
response in if let JSON = response.result.value{
if JSON.count != 0{
let errorList = JSON["responseErrorsList"] as? NSArray
for error in errorList!{
let erro: String = error as! String
switch erro{
case "EntityRequired":
with the migration from Swift 2 to Swift 4 I am having problems since errosList comes to nil however the result of JSON is as follows:
["Rate": "Level": "Code": "ID": 0, "Zone": "Address": "Errorslistserver": <__Nssingleobjectarrayi 0x17400ba90>( Invalidcode ) , "Subzone": ]
Does anyone know how to access the "Errorslistserver" field and get the errors that in this case is "Invalidcode".
What I have implemented and is not working is as follows::
if let JSON = response.result.value as? [String: Any]{
if (JSON as AnyObject).count != 0{
let errorList = JSON["responseErrorsList"] as? [[String: Any]]