- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { CLLocation *location = [locations lastObject]; [self.locationManager stopUpdatingLocation]; CLGeocoder *geocoder = [[CLGeocoder alloc] init]; [geocoder reverseGeocodeLocation:location completionHandler:^(NSArray *placemarks, NSError *error) { // 緯度 CLLocationDegrees latitude = location.coordinate.latitude; // 經度 CLLocationDegrees longitude = location.coordinate.longitude; CLPlacemark *place = [placemarks lastObject]; // NSLog(@"City,%@",place.addressDictionary[@"City"]); // NSLog(@"Country,%@",place.addressDictionary[@"Country"]);
// NSLog(@"CountryCode,%@",place.addressDictionary[@"CountryCode"]); // NSLog(@"FormattedAddressLines,%@",place.addressDictionary[@"FormattedAddressLines"]); // NSLog(@"Name,%@",place.addressDictionary[@"Name"]); // NSLog(@"State,%@",place.addressDictionary[@"State"]); // NSLog(@"Street,%@",place.addressDictionary[@"Street"]); // NSLog(@"SubLocality,%@",place.addressDictionary[@"SubLocality"]); // NSLog(@"Thoroughfare,%@",place.addressDictionary[@"Thoroughfare"]); // 位置名 NSLog(@"name,%@",place.name); // 街道 NSLog(@"thoroughfare,%@",place.thoroughfare); // 子街道 NSLog(@"subThoroughfare,%@",place.subThoroughfare); // 市 NSLog(@"locality,%@",place.locality); // 區 NSLog(@"subLocality,%@",place.subLocality); // 國家 NSLog(@"country,%@",place.country); }