I updated swift 3 and I found many errors. This is one of them:
A value of type "Any?" doesn't have a member object '
This is my code:
jsonmanager.post( "http://myapi.com",
parameters: nil,
success: { (operation: AFHTTPRequestOperation?,responseObject: Any?) in
if(((responseObject? as AnyObject).object(forKey: "meta") as AnyObject).object(forKey: "status")?.intValue == 200 && responseObject?.object(forKey: "total_data")?.intValue > 0){
let aa: Any? = (responseObject? as AnyObject).object(forKey: "response")
self.data = (aa as AnyObject).mutableCopy()
}
New error update:
The optional chain has no effect, the expression already produces "Any?"
and
It is not possible to call a value of the non-function type "Any ?!"
Works well in previous version 7.3.1 swift 2.
This is json's answer:
{
"meta":{"status":200,"msg":"OK"},
"response":[""],
"total_data":0
}
source
share