I am currently trying to make a searchbar that autopopulates with locations as the user types. I am using a MKLocalSearch to get a MKLocalSearchResponse and it appears to return values I can use. However to get the name, address or coordinates out of the search needs access to the MKPlacemark property in the search response. When I access the placemark I get the error:
'placemark' is unavailable: APIs deprecated as of iOS7 and earlier are unavailable in Swift
var request = MKLocalSearchRequest()
request.naturalLanguageQuery = searchText
//PUT HERE: check if network is on?
let localSearch: MKLocalSearch = MKLocalSearch(request: request)
localSearch.startWithCompletionHandler { (response: MKLocalSearchResponse!, error: NSError!) -> Void in
if (error == nil) {
println("searched")
for res in response.mapItems {
self.userSearch.append(res.placemark)
}
self.userSearch = response.mapItems.placemark
self.tableView?.reloadData()
} else {
println(error)
}
}
}
Does anyone know a workaround to accessing the placemark?
Thanks!