0

I'm trying to get placemark for a location in iOS. I've got the location, but reverseGeocodeLocation: completionHandler: method show me an error.

found placemarks: (null); error: Error Domain=kCLErrorDomain Code=2 "(null)"

The difference between this one and that one is: I never got any placemarks successfully and I sent request for only once.

environment:

Xcode 7.1

iOS 9

iPhone 6 simulator

code:

[_geocoder reverseGeocodeLocation:_location completionHandler:
     ^(NSArray<CLPlacemark *> * _Nullable placemarks, NSError * _Nullable error) {
         NSLog(@"found placemarks: %@; error: %@", placemarks, error);

         _lastGeocodingError = error;
         if (error == nil && [placemarks count] > 0) {
             _placeMark = [placemarks lastObject];
         } else {
             _placeMark = nil;
         }
         NSLog(@"%@", _lastGeocodingError);

         _performingReverseGeocoding = NO;
         [self updateLabels];
     }];

log:

2015-10-21 06:40:31.591 MyLocations[7055:5543364] _location is <+55.75578600,+37.61763300> +/- 5.00m (speed -1.00 mps / course -1.00) @ 10/21/15, 6:40:31 AM China Standard Time
2015-10-21 06:40:32.901 MyLocations[7055:5543364] found placemarks: (null); error: Error Domain=kCLErrorDomain Code=2 "(null)"
Community
  • 1
  • 1
lxmfly123
  • 126
  • 9

0 Answers0