2011-12-21 84 views
2

我试图将Google Places API集成到我的iOS应用程序中。我指的是这个博客: http://iphonebyradix.blogspot.com/2011/07/working-with-google-places-api.html在Google Places API中嵌入当前位置(经度和纬度)

现在我发现了我目前的iPhone的位置,我怎么嵌入我已经钻进了以下网址,而不是“位置= 34.0522222经度和纬度,-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] – 2012-01-02 07:46:26

相关问题