iOS reverseGeocodeLocation错误

时间:2015-10-20 23:02:02

标签: ios clgeocoder

我正在尝试在iOS中获取某个位置的地标。我有位置,但是reverseGeocodeLocation:completionHandler:方法显示错误。

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

这个和that one之间的区别是:我从未成功找到任何地标,我只发送了一次请求。

环境:

Xcode 7.1

iOS 9

iPhone 6模拟器

[_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];
     }];

登录

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)"

0 个答案:

没有答案