2012-04-06 96 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