내 응용 프로그램에서 앞으로 지오 코딩을 사용하여 사용자가 검색 창에 주소를 입력 한 다음지도에 마커를 배치 할 수있게하려고합니다.목표 C : Google API (Forward GeoCoding)를 사용하는 경우 앱 요금을 청구 할 수 있습니까?
다음 방법이 의도 한대로 작동하는지 다시 한 번 확인할 수 있습니까?
-(CLLocationCoordinate2D) addressLocation {
NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&output=csv",
[searchBar.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
//NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString]];
NSError* error;
NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString] encoding:NSASCIIStringEncoding error:&error];
NSArray *listItems = [locationString componentsSeparatedByString:@","];
double latitude = 0.0;
double longitude = 0.0;
if([listItems count] >= 4 && [[listItems objectAtIndex:0] isEqualToString:@"200"]) {
latitude = [[listItems objectAtIndex:2] doubleValue];
longitude = [[listItems objectAtIndex:3] doubleValue];
}
else {
//Show error
}
CLLocationCoordinate2D location;
location.latitude = latitude;
location.longitude = longitude;
return location;
}
나는 위의 방법으로 위도와 경도를 얻고 그에 따라지도에 주석을 추가 할 것입니다. 이를 위해 APIKey에 등록해야합니까? 그렇다면 어디에 넣어야합니까?이 경우 내 앱 요금을 청구 할 수 있습니까?
감사합니다.
젠 괭이
고마워! 하지만 지오 코딩 부분이 앱의 핵심이 아니라는 점이 중요합니까? 또한 사용자가 길 찾기를 요청하려고 할 때 map.app을 호출 했습니까? Google에 메모를 남겼지 만 답장을 보낼지 확실하지 않은 경우 ... – Zhen