I'm developing an iOS app with reverse geocoding features. When I call the function the first time everything is fine. After the second call (with a new instance of the controller where the call is done) the "Domain=kCLErrorDomain Code=2" Error appears. This happens on the Simulator and on the device. The Coordinates are valid. My Code:
CLGeocoder *geoCoder = [[CLGeocoder alloc] init];
CLLocation *loc = [[CLLocation alloc] initWithLatitude:cityCoords.latitude longitude:cityCoords.longitude];
self.displayedCity = [[Stadt alloc] init];
[geoCoder reverseGeocodeLocation:loc completionHandler:^(NSArray *placemarks, NSError *error) {
if(!error){
for (CLPlacemark * placemark in placemarks) {
self.displayedCity.name = [placemark locality];
self.displayedCity.stadtCoord = placemark.region.center;
}
[self loadCity:self.displayedCity.name];
}
else{
NSLog(@"failed getting city: %@", [error description]);
}
}];
Thanks in advance!!