Ich implementiere Google Places Autocomplete API für MapKit
in iOS 7 mit SPGooglePlacesAutoComplete Github-Bibliothek. Nach der sorgfältigen Umsetzung alles der letzten Phase, wo ich meine Annotation
an den ausgewählten Ort durch den Benutzer verschieben möchte gibt es den Fehler Domain=kCLErrorDomain Code=8
.
Dies geschieht, nachdem der Benutzer einen bestimmten Ort aus dem Autocomplete-Ergebnis ausgewählt hat. So ist es das, was ich in meinem didSelectRowAtIndexPath
Methode mache:CLPlacemark von Place konnte den ausgewählten Ort nicht zuordnen
[self.searchDisplayController setActive:NO animated:YES];
SPGooglePlacesAutocompletePlace *place = [placesArray objectAtIndex:indexPath.row];
[place resolveToPlacemark:^(CLPlacemark *placemark, NSString *addressString, NSError *error) {
if (error) {
SPPresentAlertViewWithErrorAndTitle(error, @"Could not map the selected Place");
}else if (placemark) {
[selectedPlaceAnnotation setCoordinate:placemark.location.coordinate];
locationLat = selectedPlaceAnnotation.coordinate.latitude;
locationLon = selectedPlaceAnnotation.coordinate.longitude;
[defaults setFloat:locationLat forKey:@"locLat"];
[defaults setFloat:locationLon forKey:@"locLon"];
selectedPlaceAnnotation.title = @"You Selected This Location";
if (![self.MapView.annotations containsObject:selectedPlaceAnnotation]==YES) {
[self.MapView addAnnotation:selectedPlaceAnnotation];
}
//[self.MapView animateToLocation:placemark.location.coordinate];
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(placemark.location.coordinate, 800, 800);
[self.MapView setRegion:[self.MapView regionThatFits:region] animated:YES];
[self.searchDisplayController.searchResultsTableView deselectRowAtIndexPath:indexPath animated:NO];
}
}
];
Wenn ich resolveToPlacemark
Parameter drucken Ich erhalte diese Placemark = (null) Address String = (null) Error = Error Domain=kCLErrorDomain Code=8 "(null)"
können Sie bitte den Objektplatz überprüfen? –
@ VishnuKumar.S Ortsobjekt druckt den richtigen Wert, den ich aus dem Suchergebnis ausgewählt habe. –