Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6252579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:49:50+00:00 2026-05-24T13:49:50+00:00

I want to pass argument into google places url string. The string is @https://maps.googleapis.com/maps/api/place/search/xml?location=52.577798767,-2.124885567&radius=500&types=bank&sensor=false&key=AIzaSyCcC9pmri9XGOgyhjoHQq37cmcbfhjfghf6bBZe80

  • 0

I want to pass argument into google places url string.
The string is

@"https://maps.googleapis.com/maps/api/place/search/xml?location=52.577798767,-2.124885567&radius=500&types=bank&sensor=false&key=AIzaSyCcC9pmri9XGOgyhjoHQq37cmcbfhjfghf6bBZe80"

i get no response. though i can get location updates. but i want to use this string in

-(void)ParseXML_of_Google_PlacesAPI { 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]; }

But not working. It gives no response.

Please suggest

Update:

This is my original code:

- (void)locationUpdate:(CLLocation *)location {



googleUrl= [[NSString alloc ]initWithFormat:@"https://maps.googleapis.com/maps/api/place

/search/xml?location=%f,%f&radius=500&name=money&sensor=false&
 key=AIzaSyCcC9pmri9XGOgyhjoHQq37cmcdfsab6bBZe80",location.coordinate.latitude,location.coordinate.longitude];

}

Update 2

googleUrl= @"https://maps.googleapis.com/maps/api/place/search/xml?location=%f,%f&radius=500&name=the%20money&sensor=false&key=AIzaSyCcC9pmrisgd9XGOgyhjoHQq37cmcb6bBZe80",a,b;

This string is also not working. becaue.when i put a=@”9.281654854″, and b=@”-3.32532″, i.e. static values in a and b and use it it also does not show any location

I have updated my question and now using same thing as shown in question and following your advice. But still it does not show any location. though it ask me to click ok to access location data. when i click ok it does not show any location. My string is ok because when i put static coordinates and used as #define googleUrl=@”string”. it works. but with dynimic coordinates it does not work

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:49:50+00:00Added an answer on May 24, 2026 at 1:49 pm

    This is a general answer to replace a parameter on any URL, probably more general than the question asks for, but didn’t quite get the use case anyway… 😛

    -(NSURL*) replaceLocation:(NSURL*)url latitude:(float)latitude longitude:(float)longitude {
    
        // query to dictionary
        NSMutableDictionary *query = [NSMutableDictionary dictionary];
        for (NSString *param in [[url query] componentsSeparatedByString:@"&"]) {
            NSArray *queryParam = [param componentsSeparatedByString:@"="];
            if([queryParam count] < 2) continue;
            [query setObject:[queryParam objectAtIndex:1] forKey:[queryParam objectAtIndex:0]];
        }
    
        // override location
        [query setObject:[NSString stringWithFormat:@"%f,%f",latitude,longitude] forKey:@"location"];
    
        // encode and reassemble
        NSMutableArray *queryComponents = [NSMutableArray array];
        for (NSString *key in query) {
            NSString *value = [query objectForKey:key];
            key = [key stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
            value = [value stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
            NSString *component = [NSString stringWithFormat:@"%@=%@", key, value];
            [queryComponents addObject:component];
        }
    
        NSString *queryString = [queryComponents componentsJoinedByString:@"&"];
    
        NSMutableString *newUrl = [NSMutableString string];
        [newUrl appendFormat:@"%@://%@",[url scheme],[url host]];
        if ([url port]!=nil){
            [newUrl appendFormat:@":%@",[url port]];
        }
        [newUrl appendFormat:@"%@",[url path]];
        if ([url parameterString]!=nil){
            [newUrl appendFormat:@";%@",[url parameterString]];
        }
        if (queryString!=nil && [queryString length]>0){
            [newUrl appendFormat:@"?%@",queryString];
        }    
        if ([url fragment]!=nil){
            [newUrl appendFormat:@"#%@",[url fragment]];
        }
    
        return [NSURL URLWithString:newUrl];
    }
    

    Usage:

    NSURL *url = [NSURL URLWithString:@"https://maps.googleapis.com/maps/api/place/search/xml?location=52.577798767,-2.124885567&radius=500&types=bank&sensor=false&key=AIzaSyCcC9pmri9XGOgyhjoHQq37cmcbfhjfghf6bBZe80"];
    NSLog(@"from \n%@ \nto\n%@", [url absoluteString], [[self replaceLocation:url latitude:0.54 longitude:0.56] absoluteString]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A function takes a string as argument, example fn(string). I want to pass different
I'm trying to pass a 'string' argument to a view with a url. The
Hey. I want to pass a variable as an argument into an nth-child selector.
I want to call a PHP file but want to pass an argument to
Here is my custom module using hook, Assume if I want to pass argument
I have a method which takes String argument. In some cases I want to
In a native function with a jbyteArray argument, I want to pass data back
I want to pass through configuration arguments to a class. These are all the
In Visual Studio Debug part, we can pass arguments. I want to know how
how to pass multiple arguments in a single function in Objective-C? I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.