Placemark property and reverse geocoding

Discussion in 'iOS Programming' started by Fuzzball27, Jan 8, 2012.

  1. Fuzzball27 macrumors member


    Aug 8, 2011
    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:
    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?
  2. Fuzzball27 thread starter macrumors member


    Aug 8, 2011
    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.

Share This Page