Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Fuzzball27

macrumors member
Original poster
Aug 8, 2011
30
1
I understand that reverse geocoding takes a while to return values, but I do not understand how to get the values it returns at the proper time. I have a CLPlacemark property in the class that uses the geocoder, and in the geocoder completion manager I have the following line of code:
Code:
placemark = [placemarks objectAtIndex:0];
(I have verified that the values are indeed being passed from placemarks to placemark by using NSLog(@"%@", placemark.x) at the end of the completion handler.)

The problem that I am having is this: I am using placemark.locality and placemark.administrativeArea as part of an NSString property in a method that is called after the method with the reverse geocoding. Either the property placemark is loosing it's values (which I don't believe is the case), or the method after the geocoding method is finished executing before the reverse geocoding is finished.

What I need to know is how can I ensure that the NSString property isn't given null values by the placemark property, and that the locality and administrative area are given instead?
 
The issue was indeed timing. I resolved it by moving CLGeocoder to the superclass of the class I was originally using, and having the completion handler give the original class the location info.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.