In my application I have location function:
- (void)locationUpdate:(CLLocation *)location {
lati = [[NSString alloc]initWithFormat:@"%f", location.coordinate.latitude] ;
longi = [[NSString alloc ]initWithFormat:@"%f", location.coordinate.longitude ];
[self ParseXML_of_Google_PlacesAPI:googleUrl];
}
...and I have another function to which I want to pass lati and longi:
-(void)ParseXML_of_Google_PlacesAPI:(NSString *)_googleUrl {
//use lati and longi in this line
googleUrl=[NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/search/xml?location=%f,%f&radius=500&name=asda&sensor=false&key=mykey",lati,longi];
NSURL *googlePlacesURL = [NSURL URLWithString:googleUrl ];
NSData *xmlData = [NSData dataWithContentsOfURL:googlePlacesURL];
xmlDocument = [[GDataXMLDocument alloc]initWithData:xmlData options:0 error:nil];
NSArray *arr = [xmlDocument.rootElement elementsForName:@"result"];
placesOutputArray=[[NSMutableArray alloc]init];
for(GDataXMLElement *e in arr ){
[placesOutputArray addObject:e];
}
}
How can I do that? I just need the values of lati and longi in the ParseXML_of_Googe_PlacesApi: method. Everything else is working fine
_googleUrlforParseXML_of_Google_PlacesAPI:but you don't use it in the method.