0
CLGeocoder를 사용하여 장치의 현재 위치를 역 지오 코딩합니다. 시뮬레이터에서 잘 작동하지만 기기 (iPhone 4 및 iPad 3)에서 kCLErrorNetwork
오류로 인해 항상 실패합니다.CLGeocoder는 항상 장치에서 실패하지만 시뮬레이터에서 작동합니다.
의 코드는 매우 간단 다음 CLLocationManager이 위치를 제공되면
unable to reverse geocode location <[redacted],[redacted]> +/- 69.94m (speed -1.00 mps/course -1.00) @ 9/4/12 10:30:19 AM Eastern Daylight Time due to error: Error Domain=kCLErrorDomain Code=2 "The operation couldn’t be completed. (kCLErrorDomain error 2.
이 방법은 호출, 그래서 방법은 항상 전달됩니다 :
는if (geocoder == nil) geocoder = [[CLGeocoder alloc] init];
[geocoder reverseGeocodeLocation:self.location completionHandler:^(NSArray *placemarks, NSError *error) {
if (error == nil) {
// Do good stuff with the placemark...
} else {
NSLog(@"unable to reverse geocode location %@ due to error: %@", self.location, error);
}
}];
인쇄 오류 메시지는 유효한 위치.
여러 Wi-Fi 네트워크와 3G 네트워크에서 사용해 보았습니다. 그것은 장치에서 결코 작동하지 않습니다.
도움이 될 것입니다.
먼저 장소 표시가 == nil인지 확인해야합니다. 그렇다면 오류를 볼 수 있습니다. – Felix
@ phix23 두렵습니다. 두 위치 표시가 문제가되지 않는 것 같습니다. –