2016-03-29 26 views
1

我已經在IOS上實現了谷歌地圖,現在我想在某些公司品牌名稱上找到標記,然後纔有在Android中實施的經驗。 在Android的getFromLocationName()獲取地址信息像拉特,從地理編碼器很長,但我沒有得到任何在IOS這樣的構建函數?什麼是替代getFromLocationName()的IOS?

有幫助嗎?

+0

其中u來襲,你能證明烏爾試圖代碼 –

+0

https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/LocationAwarenessPG/UsingGeocoders/UsingGeocoders .html#// apple_ref/doc/uid/TP40009497-CH4-SW5我正在使用此網址進行正向地理編碼,我想要發送地址並獲取標記在其上的標記,但出現錯誤Error Domain = kCLErrorDomain Code = 8「 (kCLErrorDomain錯誤8.)「 –

+0

[實用程序正向地址:addressString completionHandler:^(NSArray *地標,NSError *錯誤){ if (錯誤) NSLog(@「Geocode error:%@」,error); else if(placemarks.count> 0) { NSArray * arr = placemarks; // addrPlacemark = [placemarks firstObject]; // NSLog(@「fwd geocode:%f%f」, // addrPlacemark.location.coordinate.latitude, 這是代碼的類型 –

回答

1

我認爲它給你錯誤,因爲,geocoder無法找到位置。

檢查這個代碼,

CLGeocoder *geocoder = [[CLGeocoder alloc] init]; 
[geocoder geocodeAddressString:@"Palolem Beach, Goa, India" completionHandler:^(NSArray* placemarks, NSError* error){ 
    if (!error) { 

     for (CLPlacemark* aPlacemark in placemarks) 
     { 
      NSLog(@"place--%@", [aPlacemark locality]); 
      NSLog(@"lat--%f\nlong--%f",aPlacemark.location.coordinate.latitude,aPlacemark.location.coordinate.longitude); 
     } 
    } 
    else{ 

     NSLog(@"error--%@",[error localizedDescription]); 
    } 
}]; 
+0

讓我試試這個,但肯德基,pune應該是正確的地址,否則如何我找到了嗎? –

+0

請原諒,請 –

+0

我想找KFC,pune –