swift - how to fix this dictionaryValue -


alamofire.request(.get,  "https://maps.googleapis.com/maps/api/place/details/json", parameters:["placeid": x , "key":"aizasyaasdaxw-j8diggjy58_hdrasdaqqa"])                 .responsejson { (responsedata) -> void in                     //debugprint(responsedata)                       switch responsedata.result{                      case .success(let req):                         let response = json(req)                          let items = response["result"]["geometry"]["location"].dictionaryvalue                          let lat: double = double(items["lat"]!.doublevalue)                         let lng: double = double(items["lng"]!.doublevalue)                          print(lat,lng)                            item in items{                           self.mapresult.append(mapmodel(json:item)) // *this error cannot convert value of type '(string:json)' expected argument type 'json'                          }                      case .failure(let err):                       print("request failed error: \(err)")                     }             } 

your items dictionary, have iterate this:

for (key, value) in items { } 

so can pass value function instead of passing dictionary element it. error seeing telling you pass dictionary argument (string:json) while expects json argument.


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -