I have longitude and latitude from the location manager, now I'm trying to change the geocode to convert this information to address strings. I found the code below that is supposed to do this, but I am getting a linker error. I think it means I'm missing some kind of structure or something like that. I could not find the answer. Can anyone help?
Error:
Apple Mach-O Linker Error "_KABPersonAddressZIPKey", referenced from:
etc. for each of the lines I'm trying to generate.
CLGeocoder *geocoder = [[CLGeocoder alloc] init]; CLLocation *newLocation = [[CLLocation alloc]initWithLatitude:latitude longitude:longitude]; [geocoder reverseGeocodeLocation:newLocation completionHandler:^(NSArray *placemarks, NSError *error) { if (error) { NSLog(@"Geocode failed with error: %@", error); return; } if (placemarks && placemarks.count > 0) { CLPlacemark *placemark = placemarks[0]; NSDictionary *addressDictionary = placemark.addressDictionary; NSString *address = [addressDictionary objectForKey:(NSString *)kABPersonAddressStreetKey]; NSString *city = [addressDictionary objectForKey:(NSString *)kABPersonAddressCityKey]; NSString *state = [addressDictionary objectForKey:(NSString *)kABPersonAddressStateKey]; NSString *zip = [addressDictionary objectForKey:(NSString *)kABPersonAddressZIPKey]; NSLog(@"%@ %@ %@ %@", address,city, state, zip); } } ];
source share