Why is this block of code not executing? I copied and pasted it from my other project, where it works perfectly. I also tried this in my other application with the same addressString that I am connecting here, and it worked perfectly.
NSString *addressString = [NSString stringWithFormat:@"%@ and %@, %@, NY", street, rightBound, [boroughs objectForKey:borough]]; NSLog(@"Address string: %@",addressString); [geocoder geocodeAddressString:addressString completionHandler:^(NSArray *placemarks, NSError *error) { NSLog(@"Placemark count:%d",[placemarks count]); for(CLPlacemark *placemark in placemarks) { NSLog(@"%@",placemark); } if(anError) { NSLog(@"Error: %@",[error description]); } }];
No tags or error messages are logged in the console.
Here is my whole AppDelegate.m:
@implementation AppDelegate @synthesize window = _window; - (void)dealloc { [_window release]; [super dealloc]; } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSError *error = nil; SBJsonParser *parser = [[SBJsonParser alloc] init]; NSString *JSONString = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Streets" ofType:@"json"] encoding:NSUTF8StringEncoding error:&error]; if(error) { NSLog(@"%@",[error description]); NSLog(@"Break"); } NSDictionary *dict = [parser objectWithString:JSONString error:&error]; if(error) { NSLog(@"%@",[error description]); NSLog(@"Break"); } NSArray *addresses = [[dict objectForKey:@"results"] retain]; NSDictionary *boroughs = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"Bronx",@"Brooklyn",@"New York", @"Queens",@"Staten Island",nil] forKeys:[NSArray arrayWithObjects:@"B",@"K",@"M",@"Q",@"S", nil]]; int i = 1; for(NSDictionary *file in addresses) { NSString *borough = [file objectForKey:@"Borough"]; NSString *ID = [file objectForKey:@"ID"]; NSString *leftBound = [file objectForKey:@"LeftBound"]; NSString *rightBound = [file objectForKey:@"RightBound"]; NSString *sideOfStreet = [file objectForKey:@"SideOfStreet"]; NSString *street = [file objectForKey:@"Street"]; NSString *addressString = [NSString stringWithFormat:@"%@ and %@, %@, NY", street, rightBound, [boroughs objectForKey:borough]];