【问题标题】:iOS forward geocoding not being executed未执行 iOS 转发地理编码
【发布时间】:2012-08-11 22:03:12
【问题描述】:

谁能告诉我为什么这段代码没有被执行?我从我的另一个项目中复制并粘贴了它,它工作得很好。我还在我的其他应用程序中尝试使用与我在这里插入的相同地址字符串,并且效果很好。但是如果我将地址直接传递给geocodeaddressstring,它只会在传递字符串变量时发生,它工作正常

NSString *addressString = @"2642 Broadway, New York, NY 10025, USA";
[forwardGeocoder1 geocodeAddressString:addressString
                          completionHandler:^(NSArray *placemarks, NSError *error){

                              // Make sure the geocoder did not produce an error
                              // before continuing
                              if(!error){

                                  // Iterate through all of the placemarks returned
                                  // and output them to the console
                                  for(CLPlacemark *placemark in placemarks){

                                NSLog(@"found");

                                  }
                              }
                              else{
                                  // Our geocoder had an error, output a message
                                  // to the console
                                  NSLog(@"There was a forward geocoding error\n%@",
                                        [error localizedDescription]);
                              }
                          }
       ];

错误:
kCLErrorDomain 错误 8.

【问题讨论】:

    标签: iphone ipad ios5 geocoding core-location


    【解决方案1】:

    请参考这个documentation

    根据文档,kCLErrorDomain error 8 表示:kCLErrorGeocodeFoundNoResult

    【讨论】:

    • 如果我像这样传递地址 NSString *addressString = [addressArray objectatindex:0];那么只会出现上述错误
    • @Arvind,请粘贴您的完整代码。这将有助于了解情况。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-11
    • 2012-12-20
    • 1970-01-01
    • 2020-06-07
    • 2012-11-02
    • 1970-01-01
    相关资源
    最近更新 更多