Sto sviluppando un app iOS con il geocoding inverso caratteristiche in base a questo articolo: geocoding tutorialCLGeocoder reverseGeocodeLocation restituisce 'kCLErrorDomain errore 9'
Ma quando ho test come questo sul simulatore, ottengo 'errore kCLErrorDomain 9'. Ho cercato un sacco e ci sono solo errore di 0 o 1 non 9.
Ecco il mio codice in viewDidLoad
:
self.locationManager = [[CLLocationManager alloc]init];
self.locationManager.delegate = self;
self.locationManager.distanceFilter = 80.0;
[self.locationManager startUpdatingLocation];
CLGeocoder *geocoder = [[[CLGeocoder alloc] init] autorelease];
[geocoder reverseGeocodeLocation:self.locationManager.location
completionHandler:^(NSArray *placemarks, NSError *error) {
NSLog(@"reverseGeocodeLocation:completionHandler: Completion Handler called!");
if (error){
NSLog(@"Geocode failed with error: %@", error);
return;
}
if(placemarks && placemarks.count > 0)
{
//do something
CLPlacemark *topResult = [placemarks objectAtIndex:0];
NSString *addressTxt = [NSString stringWithFormat:@"%@ %@,%@ %@",
[topResult subThoroughfare],[topResult thoroughfare],
[topResult locality], [topResult administrativeArea]];
NSLog(@"%@",addressTxt);
}
}];
Grazie mille.
Il simulatore restituisce l'errore 8 ora mentre non ho fatto nulla al mio codice. – goofansu
CLLocationManager, CLGeocoder Non funziona sul simulatore. Visualizzerà i risultati solo sul debug sul dispositivo o sul test sul dispositivo. Sul simulatore mostrerà l'errore. –
Funziona come un fascino sul mio dispositivo iPhone 4. Grazie! – gstroup