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

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -