2011-12-21 4 views
2

Google 지역 정보 API를 내 iOS 앱에 통합하려고합니다. 나는 아이폰 내 현재 위치를 알아내는하고 이제 http://iphonebyradix.blogspot.com/2011/07/working-with-google-places-api.htmlGoogle 지역 정보 API에 현재 위치 (경도 및 위도) 포함하기

, 내가 대신 위치 = 34.0522222 "다음 URL로 가지고 위도와 경도를 포함 어떻게 -118.2427778 :이 블로그를 참조하고 ":

#define PlacesURL @"https://maps.googleapis.com/maps/api/place/search/xml?location=34.0522222,-118.2427778&radius=500&types=restaurants&sensor=false&key=Your_API_Key" 

코드에서 주어진 하드 코딩 된 위치 근처가 아니라 현재 위치 근처에 식당 위치가 표시됩니다.

감사합니다.

답변

1
CLLocation *location = [[AppHelper appDelegate] mLatestLocation];//custom code to get latestPosition of user 


NSString *url=[NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/search/xml?location=%f,%f&radius=500&types=restaurants&sensor=false&key=Your_API_Key" 
,location.coordinate.longitude,location.coordinate.latitude]]; 
+0

이제 문제가 발생했습니다. 어떻게 [location.coordinate.longitude, location.coordinate.latitude]를 정의 할 것인가? –