i'm testing out reversegeocodelocation app shows closest address. i've gotten work except showing of current state in (il, ny, ext.). how do that? current code:
clgeocoder().reversegeocodelocation(userlocation) { (placemarks, error) -> void in if error != nil { println(error) } else { let pm = clplacemark(placemark: placemarks![0] clplacemark) var subthoroughtare:string = "" var thoroughfare:string = "" var sublocality:string = "" var subadministrativearea:string = "" var postalcode:string = "" var country:string = "" if pm.subthoroughfare != nil {subthoroughtare = pm.subthoroughfare!} if pm.thoroughfare != nil {thoroughfare = pm.thoroughfare!} if pm.sublocality != nil {sublocality = pm.sublocality!} if pm.subadministrativearea != nil {subadministrativearea = pm.subadministrativearea!} if pm.postalcode != nil {postalcode = pm.postalcode!} if pm.country != nil {country = pm.country!} self.addresslabel.text = "\(subthoroughtare) \(thoroughfare) \n \(sublocality) \n \(postalcode) \n \(country)" } } and output (example location):
county road 1760 79529 united states
for state want @ administrativearea
let state = pm.administrativearea; if @ definition clplacemark class shows..
var administrativearea: string! { } // state, eg. ca
Comments
Post a Comment