1110 1110 - 1 year ago 176
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];

Answer Source

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>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download