iOS CLGeocoder Reverse Geocoding Problem

Fuzzball27

macrumors member
Original poster
Aug 8, 2011
30
1
When I run this method, NSLog doesn't give any results. What am I missing?
Code:
-(void)cityState:(CLLocation *)l
{
    CLGeocoder *geocoder = [[[CLGeocoder alloc] init] autorelease];
    [geocoder reverseGeocodeLocation:l completionHandler:^(NSArray *placemarks, NSError *error) {
        CLPlacemark *placemark = [placemarks objectAtIndex:0];
        [self setCity:[placemark locality]];
        [self setState:[placemark administrativeArea]];
        NSLog(@"%@ %@", city, state);
    }];
}
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
8,580
4,020
If the NSLog isn't outputting anything, wouldn't that suggest that the method simply isn't being called?

Set a breakpoint in the method to verify its getting called.
 

Sydde

macrumors 68020
Aug 17, 2009
2,118
2,751
IOKWARDI
NSLog is not outputting anything: does that mean you see the log stamp (date, time, etc) with no string following, or is there no log stamp at all?

And have you tried checking whether there is a reported error?
 

Fuzzball27

macrumors member
Original poster
Aug 8, 2011
30
1
I just realized the problem. I wasn't connected to the internet. It's working fine now. Thank you for the help.