Swift 如何修复此dictionaryValue

Swift 如何修复此dictionaryValue,swift,alamofire,swifty-json,Swift,Alamofire,Swifty Json,您的项是一个字典,然后您必须像这样迭代它: Alamofire.request(.GET, "https://maps.googleapis.com/maps/api/place/details/json", parameters:["placeid": x , "key":"AIzaSyAasdaXW-j8DIgGjY58_HdrasdaqqA"]) .responseJSON { (responseData) -> Void in

您的
是一个字典,然后您必须像这样迭代它:

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)



                        for item in items{


                        self.mapResult.append(mapModel(json:item)) // *THIS ERROR AS CANNOT CONVERT VALUE of TYPE '(STRING:JSON)' to EXPECTED ARGUMENT TYPE 'JSON'

                        }

                    case .Failure(let err):
                      print("Request failed with error: \(err)")
                    }
            }

这样您就可以将值传递到该函数中,而不是将字典元素传递到该函数中。您看到的错误告诉您正在传递一个dictionary参数(String:JSON),而它需要一个JSON参数。

我应该怎么做错误先生,您能给我举个例子吗?我要在swifti中调用struct model,我尝试这样做,但出现了错误。错误是“JSON”不能转换为([JSON],[JSON])
for (key, value) in items {
}