MapKit
için google places autocomplete api'yi iOS 7'de SPGooglePlacesAutoComplete github kitaplığı kullanarak uygulıyorum. Her şeyi dikkatli bir şekilde uygulayarak son konumumu Annotation
kullanıcı tarafından seçilen yere taşımak istediğimde hata veriyor Domain=kCLErrorDomain Code=8
.
Bu, kullanıcı otomatik tamamlama sonucundan belirli bir yeri seçtikten sonra gerçekleşir.Yerden CLPlacemark, seçili Yer'i eşleyemedi
[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];
}
}
];
Ben o SPPlaceTypeEstablishment
olarak ayarlanırsa bu Placemark = (null) Address String = (null) Error = Error Domain=kCLErrorDomain Code=8 "(null)"
Nesne yerini kontrol edebilir misiniz? –
@ VishnuKumar.S yer nesnesi, arama sonucundan seçtiğim doğru değeri basıyor. –