역 지오 코딩 기능이있는 iOS 앱을 개발하고 있습니다. 함수를 처음 호출하면 모든 것이 정상입니다. 두 번째 호출 (호출이 완료된 컨트롤러의 새 인스턴스 사용) "Domain = kCLErrorDomain Code = 2"오류가 나타납니다. 이것은 시뮬레이터와 장치에서 발생합니다. 좌표는 유효합니다. 내 코드 : 사전에CLGeocoder reverseGeocodeLocation "kCLErrorDomain error 2"
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]);
}
}];
감사합니다! 다음은이 오류에
답변을 받으셨습니까? –