【问题标题】:CLGeocoder reverseGeocodeLocation returning nil placemarks randomlyCLGeocoder reverseGeocodeLocation 随机返回 nil 地标
【发布时间】:2014-08-21 06:56:17
【问题描述】:

我正在调用以下方法,但地标 NSArray 随机返回为零。如果位置为零,我设置了一个断点,并且我已经验证该位置是一个有效的对象,即使地标返回为零也是如此。我不知道出了什么问题?有什么建议吗?

-(void)geocodeRequest:(CLLocation *)location {

CLGeocoder
* gc = [[CLGeocoder alloc] init];

if(nil == location){
    DLog(@"");
}

[gc reverseGeocodeLocation:(CLLocation *)(location) completionHandler:^(NSArray *placemarks, NSError *error) {

    //Get address
    CLPlacemark *placemark = [placemarks objectAtIndex:0];  <-- nil sometimes
.....
.....

 }];
}// end geocodeRequest method

// 更新 //

出错了!!!

Error Domain=kCLErrorDomain Code=2 "The operation couldn’t be completed. (kCLErrorDomain error 2.)"

【问题讨论】:

标签: ios objective-c reverse-geocoding


【解决方案1】:

问题是这个错误是苹果没有返回结果,因为我已经向他们的 API 发出了许多请求。

"Error Domain=kCLErrorDomain Code=2 "操作无法完成。 (kCLErrorDomain 错误 2.)"

我重写了应用程序的一部分,因此它不会经常要求 Apples API 反向地理编码。我还连接了 Google 的 API,所以如果 Apple 返回此错误,我会要求 Google 执行反向地理编码。

【讨论】:

    猜你喜欢
    • 2012-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-03
    • 1970-01-01
    相关资源
    最近更新 更多