iPhone simulator works fine, but iPhone aways get kCLErrorGeocodeFoundNoResult; here is the code snipet:
CLLocationCoordinate2D cordinate = value.MKCoordinateValue;
CLLocation *location = [[CLLocation alloc] initWithLatitude:cordinate.latitude longitude:cordinate.longitude];
NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"ja"];
if (self.geocoder.isGeocoding) {
NSLog(@"doing reverse address and return");
[self.geocoder cancelGeocode];
return;
}
[self.geocoder reverseGeocodeLocation:location preferredLocale:usLocale completionHandler:^(NSArray<CLPlacemark *> * _Nullable placemarks, NSError * _Nullable error) {
if ( error == nil) {
}else{
NSLog(@"%f %f reverse address with error:%@ placemarks:%@" , cordinate.latitude, cordinate.longitude,error, placemarks);
if (error.code == kCLErrorGeocodeFoundNoResult) {
NSLog(@"kCLErrorGeocodeFoundNoResult");
}
}
}];