2012-04-06 94 views

回答

0

您可以访问谷歌Places API的

http://maps.google.com/maps/geo?q=yourSearchName&output=xml

这将给有关规定,searchname细节。您可以解析xml并从该详细信息中获取经度和纬度,并可以针对这些位置进行注释。

输出也可以在json和csv中。

一些代码,可以帮助

NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&output=csv",coordinate]; //coordinate=-30.347744,71.3737373 
NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString]]; 
NSArray *listItems = [locationString componentsSeparatedByString:@","]; 

参考谷歌APi的Here

+0

谢谢,但有没有使用XML或JSON和CSV什么办法?仅使用iOS API。 – 2012-04-06 07:13:23

+2

我认为,而不是MKReverseGeocoder苹果移动到CLGeocoder。尝试使用这个。 http://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CLGeocoder_class/Reference/Reference.html#//apple_ref/occ/cl/CLGeocoder – iPrabu 2012-04-06 07:19:15

+0

有没有任何示例代码?我已经看过CLGeocoder,但我知道如何实现它和ID我没有错,我们必须使用地图。 – 2012-04-06 07:26:29