Reputation: 21
I am trying to integrate Google Places API into my iOS app. I am referring to this blog : http://iphonebyradix.blogspot.com/2011/07/working-with-google-places-api.html
Now I am finding out my current location of the iPhone, how do I embed the longitude and latitude which I have got into the following URL instead of "location=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"
So that I get the restaurants locations near my current location and not near the hard coded location given in the code.
Thanks and Regards.
Upvotes: 2
Views: 689
Reputation: 303
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]];
Upvotes: 1