Become a MacRumors Supporter for $25/year with no ads, private forums, and more!
  • Did you order new AirTags? We've opened a dedicated AirTags forum.

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
9,124
5,093
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.
 
Comment

Sydde

macrumors 68020
Aug 17, 2009
2,218
6,621
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?
 
Comment

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.
 
Comment
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.