- (void)GEOLocator
{
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
CLLocation *myLocation = [[CLLocation alloc] initWithLatitude:currentCentre.latitude longitude:currentCentre.longitude];
[geocoder reverseGeocodeLocation:myLocation completionHandler: ^(NSArray *placemarks, NSError *error)
{
// the returned error code is 0
NSLog(@"%ld",(long)error.code);
// there’s only one entry in the placemarks NSArray
NSLog(@"placemarks count(%lu)",(unsigned long)[placemarks count]);
CLPlacemark *placemark = [placemarks firstObject];
// and the country property is null
NSLog(@"placemark.country(%@)",placemark.country);
}
];
}
currentCentre.latitude and currentCentre.longitude is hardcoded to downtown San Francisco: these have been proven to work.
the NSLog output’s are:
2015-08-29 15:47:48.299 WheresMyBeer[10128:548448] 0
2015-08-29 15:47:48.299 WheresMyBeer[10128:548448] placemarks count(1)
2015-08-29 15:47:48.300 WheresMyBeer[10128:548448] placemark.country((null))
can someone please explain how this is? the latest Xcode/iOS download no longer can tell me what country I’m in?!