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
radius
inCLRegion
and it says to useCLCircularRegion
instead.Note that
CLCircularRegion
is a subclass ofCLRegion
.CLCircularRegion
has the same properties thatCLRegion
had (includingradius
).This matters if you are the one creating a
CLRegion
with the intention of using itsradius
property.However, here, it is the SDK itself (specifically the
geocodeAddressString
method) which has to worry about it and handle it.In iOS 7, that method indeed handles it by returning a
CLCircularRegion
for the placemark'sregion
property.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: