I am calling the following method, but randomly the placemarks NSArray is coming back nil. I have a break point set if location is nil and I have validated that the location is a valid object even when placemarks comes back nil. I can't figure out what is going wrong? Any suggestions?
-(void)geocodeRequest:(CLLocation *)location {
CLGeocoder
* gc = [[CLGeocoder alloc] init];
if(nil == location){
DLog(@"");
}
[gc reverseGeocodeLocation:(CLLocation *)(location) completionHandler:^(NSArray *placemarks, NSError *error) {
//Get address
CLPlacemark *placemark = [placemarks objectAtIndex:0]; <-- nil sometimes
.....
.....
}];
}// end geocodeRequest method
// UPDATE //
It is erroring out with!!!
Error Domain=kCLErrorDomain Code=2 "The operation couldn’t be completed. (kCLErrorDomain error 2.)"