Alamofire with google geocoding api

谁都会走 提交于 2019-12-06 06:34:20

Ok, I have finally figured this out (with the help from @cnoon). The value which is returned is of type Result. I couldn't find documentation for it, but the source code is available here.

In order to retrieve JSON below implementation can be used:

Alamofire.request(.GET, "https://mapss.googleapis.com/maps/api/geocode/json", parameters: parameters).responseJSON(options:.MutableContainers) { _, _, JSON in
    switch JSON {

    case .Failure(_, let error):
        self.error = error
        break

    case .Success(let value):
        print(value)
        break

    }
}

The value printed is the correct representation of response from Geocoding APIs.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!