ios - Why the Alamofire return early? -


 alamofire.request(.get, gaode, parameters: ["location": location,"key":key])         .responsejson { response in             guard response.response?.statuscode == 200 else{                 return             }             js = json(response.result.value!)             guard js["infocode"].string! == "10000" else             {                 return             }             print("json: \(js)")             guard js["regeocode"]["formatted_address"].string != nil else{                 return             }             print(js["regeocode"]["formatted_address"].string)     }     return js["regeocode"]["formatted_address"].string! 

the code execute return js["regeocode"]["formatted_address"].string! before response. why?i want json before return. how solve problem?

the return outside response block, being returned totally separately network request.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -