-(void)viewWillAppear:(BOOL)animated
{
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
[super viewWillAppear:animated];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
MKReverseGeocoder *geoCoder = [[MKReverseGeocoder alloc] initWithCoordinate:newLocation.coordinate];
geoCoder.delegate = self;
[geoCoder start];
}
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
NSLog(@"Detail is:--> %@",placemark);
NSString *strCountry = [NSString stringWithFormat:@"Current Cuntry %@",[placemark.addressDictionary objectForKey:@"Country"]];
NSLog(@"label detail is:--> %@",strCountry);
lblAddress.text = strCountry;
}
试试这个代码......这肯定会为您提供当前国家/地区的详细信息。