I'm using the geocodeAddressString:completionHandler: method, which returns an array of CLPlacemarks. I have to get latitude, longitude, mnemonical name and radius. While getting the first 3 is easy:
double lat = placemark.location.coordinate.latitude;
double lng = placemark.location.coordinate.longitude;
NSString *name = [NSString stringWithFormat:@"%@", ABCreateStringWithAddressDictionary(placemark.addressDictionary, NO)]
I don't know how to get the radius now, as placemark.region.radius is deprecated. Any ideas what to use now instead? I can't find anything interesting enough in documentation.
The deprecation note is for
radiusinCLRegionand it says to useCLCircularRegioninstead.Note that
CLCircularRegionis a subclass ofCLRegion.CLCircularRegionhas the same properties thatCLRegionhad (includingradius).This matters if you are the one creating a
CLRegionwith the intention of using itsradiusproperty.However, here, it is the SDK itself (specifically the
geocodeAddressStringmethod) which has to worry about it and handle it.In iOS 7, that method indeed handles it by returning a
CLCircularRegionfor the placemark'sregionproperty.Essentially, you don't have to do or change anything here since the property names are identical.
This code will work from iOS 4 to iOS 7: