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
in CLRegion
and it says to use CLCircularRegion
instead.
Note that CLCircularRegion
is a subclass of CLRegion
.
CLCircularRegion
has the same properties that CLRegion
had (including radius
).
This matters if you are the one creating a CLRegion
with the intention of using its radius
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's region
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:
NSLog(@"radius=%f", placemark.region.radius);