The homepage has been revised to provide comments.
Iphone obtains the address details
-(Id) initWithCoordinate :( CLLocationCoordinate2D) coordinate {
If (self = [super init]) {
// Custom initialization
ReverseGeocoder = [[MKReverseGeocoder alloc] initWithCoordinate: coordinate];
ReverseGeocoder. delegate = self;
[ReverseGeocoder start];
//......
}
Return self;
}
# Pragma mark MKReverseGeocoderDelegate
-(Void) reverseGeocoder :( MKReverseGeocoder *) geocoder didFailWithError :( NSError *) error
{
NSString * errorMessage = [error localizedDescription];
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle: @ "failed to obtain details"
Message: errorMessage
Delegate: nil
CancelButtonTitle: @ "OK"
OtherButtonTitles: nil];
[AlertView show];
[AlertView release];
}
-(Void) reverseGeocoder :( MKReverseGeocoder *) geocoder didFindPlacemark :( MKPlacemark *) placemark
{
NSLog (@ "% @", placemark. locality );
}
// ================================================ ========================
Street = No. 18 keyun Road
Thoroughfare = keyun Road
SubThoroughfare = 18
City = Guangzhou
SubLocality = Tianhe District
State = Guangdong Province
SubAdministrativeArea = (null)
ZIP = (null)
Country = China
{
City = "Guangzhou City ";
Country = "China ";
CountryCode = CN;
FormattedAddressLines = (
"China ",
"Tianhe District, Guangzhou City, Guangdong Province ",
"No. 18 keyun Road"
);
State = "Guangdong Province ";
Street = "No. 18 keyun Road ";
SubLocality = "Tianhe District ";
SubThoroughfare = "18 ";
Thoroughfare = "keyun Road ";
}
MKPlacemark:
@ Property (nonatomic, readonly) NSDictionary * addressDictionary; // address dictionary
@ Property (nonatomic, readonly) NSString * thoroughfare; // street name -- "keyun Road"
@ Property (nonatomic, readonly) NSString * subThoroughfare; // house number -- "18"
@ Property (nonatomic, readonly) NSString * locality; // City -- "Guangzhou City"
@ Property (nonatomic, readonly) NSString * subLocality; // district/county-"Tianhe District"
@ Property (nonatomic, readonly) NSString * administrativeArea; // identity -- "Guangdong Province"
@ Property (nonatomic, readonly) NSString * subAdministrativeArea; // No information is obtained. I don't know what it is.
@ Property (nonatomic, readonly) NSString * postalCode; // zip code -- I don't know why. I didn't get it here.
@ Property (nonatomic, readonly) NSString * country; // country-"China"
@ Property (nonatomic, readonly) NSString * countryCode; // country code -- "CN"