HI all i integrated google map in my applications, i am getting lat and long of current location and try to get place mark from those lat and long but i get strange error in my code when i used geocode.Wie erhalten Sie Ortsangaben aus Längen- und Breitengrad in googlemaps?
-(void)viewDidload
{
_locationManager = [[CLLocationManager alloc] init];
_locationManager.desiredAccuracy = kCLLocationAccuracyBest;
_locationManager.delegate = self;
[self GetMyLocation];
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:0 longitude:0 zoom:16];
_mapView = [GMSMapView mapWithFrame:self.view.frame camera:camera];
_mapView.myLocationEnabled = YES;
[_mapView setMapType:kGMSTypeNormal];
[self.firstview addSubview:_mapView];
}
- (void) GetMyLocation{
_locationManager.delegate = self;
_locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[_locationManager startUpdatingLocation];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
NSLog(@"My location %@", [locations lastObject]);
CLLocation *currentLocation = [locations lastObject];
[_mapView animateToLocation:currentLocation.coordinate];
CLGeocoder *geocoder = [[CLGeocoder alloc] init] ;
[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);
}
}];
}
I get this error in my console area Error Error Domain=kCLErrorDomain Code=8 "(null)"
get this error in console
2016-05-04 11:36:23.578 Juststart[2220:673181] ClientParametersRequest failed, 2 attempts remaining (0 vs 7). Error Domain=NSURLErrorDomain Code=-1001 " The request timed out." UserInfo={ NSErrorFailingURLStringKey=https://clients4.google.com/glm/mmap, _kCFStreamErrorCodeKey=-2102, NSErrorFailingURLKey=https://clients4.google.com/glm/mmap, NSLocalizedDescription=The request timed out., _kCFStreamErrorDomainKey=4, NSUnderlyingError=0x1478c690 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102}}}
2016-05-04 11: 36: 32,653 Juststart [2220: 673.181] ClientParametersRequest fehlgeschlagen, 7 Versuche verbleibenden (0 vs 7). Fehlerdomäne = NSURLErrorDomain Code = -1001 "Die Anforderung ist abgelaufen." Userinfo = {NSErrorFailingURLStringKey = https://clients4.google.com/glm/mmap, _kCFStreamErrorCodeKey = -2102, NSErrorFailingURLKey = https://clients4.google.com/glm/mmap, NSLocalizedDescription = Die Zeitüberschreitung der Anforderung., _kCFStreamErrorDomainKey = 4, NSUnderlyingError = 0x145c8610 {Fehler Domain = kCFErrorDomainCFNetwork-Code = -1001 "(null)" Userinfo = {_ kCFStreamErrorDomainKey = 4, _kCFStreamErrorCodeKey = -2102}}} 2016-05-04 11: 36: 48.671 Juststart [2220: 673181] ClientParametersRequest fehlgeschlagen, 6 Versuche bleiben (0 vs 7). Fehlerdomäne = NSURLErrorDomain Code = -1001 "Die Anforderung ist abgelaufen." Userinfo = {NSErrorFailingURLStringKey = https://clients4.google.com/glm/mmap, _kCFStreamErrorCodeKey = -2102, NSErrorFailingURLKey = https://clients4.google.com/glm/mmap, NSLocalizedDescription = Die Zeitüberschreitung der Anforderung., _kCFStreamErrorDomainKey = 4, NSUnderlyingError = 0x14551c30 {Fehler Domain = kCFErrorDomainCFNetwork-Code = -1001 "(null)" Userinfo = {_ kCFStreamErrorDomainKey = 4, _kCFStreamErrorCodeKey = -2102}}} 2016-05-04 11: 37: 05.707 Juststart [2220: 673181] ClientParametersRequest fehlgeschlagen, 5 Versuche verbleiben (0 vs 7). Fehlerdomäne = NSURLErrorDomain Code = -1001 "Die Anforderung ist abgelaufen." Userinfo = {NSErrorFailingURLStringKey = https://clients4.google.com/glm/mmap, _kCFStreamErrorCodeKey = -2102, NSErrorFailingURLKey = https://clients4.google.com/glm/mmap, NSLocalizedDescription = Die Zeitüberschreitung der Anforderung., _kCFStreamErrorDomainKey = 4, NSUnderlyingError = 0x14586b90 {Fehler Domain = kCFErrorDomainCFNetwork-Code = -1001 "(null)" Userinfo = {_ kCFStreamErrorDomainKey = 4, _kCFStreamErrorCodeKey = -2102}}} 2016-05-04 11: 37: 10.712 Juststart [2220: 673181] ClientParametersRequest schlug fehl, 1 Versuche verbleiben (0 vs 7). Fehlerdomäne = NSURLErrorDomain Code = -1001 "Die Anforderung ist abgelaufen." Userinfo = {NSErrorFailingURLStringKey = https://clients4.google.com/glm/mmap, _kCFStreamErrorCodeKey = -2102, NSErrorFailingURLKey = https://clients4.google.com/glm/mmap, NSLocalizedDescription = Die Zeitüberschreitung der Anforderung., _kCFStreamErrorDomainKey = 4, NSUnderlyingError = 0x15f2cf50 {Fehler Domain = kCFErrorDomainCFNetwork-Code = -1001 "(null)" Userinfo = {_ kCFStreamErrorDomainKey = 4, _kCFStreamErrorCodeKey = -2102}}} 2016.05.04 11: 37: 25,237 Juststart [2220: 673.395] CFNetwork SSLHandshake fehlgeschlagen (-9806)
Vielen Dank für Ihre Antwort Sir –
Überprüfung dieses eine Mal bro http://stackoverflow.com/questions/26376151/not-able-to-get-the-users-location-in-ios-8-using- cllocation-manager –
ok Herr kann sein, es wird für mich funktionieren –