I have an CLLocationCoordinate2D
object which contains the coordinate of a location.
I want to set the property city
(NSString
) to the city name of this location.
Note: I'm using Google Maps iOS SDK
if it's matters.
Note II: I'm not using -reverseGeocoder: didFindPlacemark:
so this question is not relevant for me.
The completion handler block is never called.
GMSGeoCode code:
//Checking user's city
__block NSString *userCity;
[[GMSGeocoder geocoder]reverseGeocodeCoordinate:self.locationManager.location.coordinate completionHandler:^(GMSReverseGeocodeResponse *response, NSError *error) {//skips completionHandler for some reason
if (error) {
NSLog(@"%@",[error description]);
}
userCity=[[[response results] firstObject] locality];
}];
//Checking saved city
__block NSString *arounderCity;
[[GMSGeocoder geocoder]reverseGeocodeCoordinate:arounder.radiusCircularRegion.center completionHandler:^(GMSReverseGeocodeResponse *response, NSError *error) {
if (error) {
NSLog(@"%@",[error description]);
}
arounderCity=[[[response results] firstObject] locality];
}];
if ([userCity isEqualToString:arounderCity]) {
return YES;
}
Anyone have an idea how to get the city name?
Thanks!