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
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);
    }];
}
 
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.
 
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?
 
I just realized the problem. I wasn't connected to the internet. It's working fine now. Thank you for the help.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.