1110 1110 - 4 months ago 84
Objective-C Question

kABPersonAddressCityKey undeclared problem

I am trying to get city name based on my geo location. Problem is that I am getting compile time error from title in this method. What have I done wrong?

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
MKPlacemark * myPlacemark = placemark;
// with the placemark you can now retrieve the city name
NSString *city = [myPlacemark.addressDictionary objectForKey:(NSString*) kABPersonAddressCityKey];


This constant is from AddressBook framework, although it is used outside of it as well. Try importing AddressBook header to fix your problem:

#import <AddressBook/AddressBook.h>