-(void)startParsing
{
xmlParser=[[NSXMLParser alloc]initWithContentsOfURL:[NSURL URLWithString:@"https://maps.googleapis.com/maps/api/place/search/xml?location=17.4297757,78.4294033&radius=500&types=restaurant&sensor=false&key=AIzaSyB2R3W5-MXd74CNVRGU30As4_Hypuq2Ysw"]];
[xmlParser setDelegate:self];
[xmlParser parse];
}
Asked
Active
Viewed 37 times
0

Anbu.Karthik
- 82,064
- 23
- 174
- 143

M Ramakrishnareddy
- 33
- 9
-
get current location latitude & longitude , then replace that values in url. check link to find current location of user http://stackoverflow.com/questions/4152003/how-can-i-get-current-location-from-user-in-ios – Saurabh Prajapati Jan 25 '16 at 12:11
1 Answers
0
do like
Step-1
Initially get update location using
didUpdateLocations
methods.
// Location Manager Delegate Methods
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
NSLog(@"%@", [locations lastObject]);
[manager stopUpdatingLocations];
CLLocation *currentLocation = [locations lastObject];
NSString *lat = [NSString stringWithFormat:@"%.2f", currentLocation.coordinate.latitude];
NSString *lon = [NSString stringWithFormat:@"%.2f", currentLocation.coordinate.longitude];
[self startParsing:lat longi:lon];
}
once you get updated locations then send the data to server
-(void)startParsing:(NSString *)lati longi:(NSString *)longa
{
NSString *stringofNewLocation=[NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/search/xml?location=%@,%@&radius=500&types=restaurant&sensor=false&key=AIzaSyB2R3W5-MXd74CNVRGU30As4_Hypuq2Ysw",lati,longa];
xmlParser=[[NSXMLParser alloc]initWithContentsOfURL:[NSURL URLWithString:stringofNewLocation]];
[xmlParser setDelegate:self];
[xmlParser parse];
}

Anbu.Karthik
- 82,064
- 23
- 174
- 143