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

  • SEARCH
  • Home
  • 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 7164149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:01:28+00:00 2026-05-28T14:01:28+00:00

On iOS 5, how can I query a web service using a JSON object?

  • 0

On iOS 5, how can I query a web service using a JSON object?
I’ve tried a bunch of different approaches and can’t get it to work. It appears that the AFNetworking or RestKit frameworks are the easiest routes, but I don’t have experience with either. I’m also new to iOS development.

Here’s an example query that works:

https://site.com/gis?QUERY={"ARGUMENTS":{"TO":{"OBJECT_TYPE":"BUILDING","OBJECT_ID":"1","TYPE":"IDENTIFIER"},"FROM":{"OBJECT_TYPE":"BUILDING","OBJECT_ID":"2","TYPE":"IDENTIFIER"},"PATHTYPES":["SIDEWALK"},"QUERYTYPE":"FINDPATH"}
  • 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-28T14:01:29+00:00Added an answer on May 28, 2026 at 2:01 pm

    Create a url request, see example below. This posts json data. In your case, your using a GET http method, so you shouldn’t need to post the json data, you can simply include it in the url. Note that some of my variable declarations are not shown.

    NSArray *keys = [NSArray arrayWithObjects:@"longitude", @"latitude", nil];
    NSArray *objects = [NSArray arrayWithObjects:longitude, latitude, nil];
    
    NSDictionary *jsonDictionary = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
    
    if([NSJSONSerialization isValidJSONObject:jsonDictionary])
    {
        __jsonData = [NSJSONSerialization dataWithJSONObject:jsonDictionary options:0 error:nil];
        __jsonString = [[NSString alloc]initWithData:__jsonData encoding:NSUTF8StringEncoding];
    }
    
    // Be sure to properly escape your url string.
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:@"https://site.com...etc"];
    [request setHTTPMethod:@"POST"];
    [request setHTTPBody: __jsonData];
    [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    [request setValue:[NSString stringWithFormat:@"%d", [__jsonData length]] forHTTPHeaderField:@"Content-Length"];  
    
    NSError *errorReturned = nil;
    NSURLResponse *theResponse =[[NSURLResponse alloc]init];
    NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&theResponse error:&errorReturned];
    
    if (errorReturned) {
        // Handle error.
    }
    else
    {
        NSError *jsonParsingError = nil;
        NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers|NSJSONReadingAllowFragments error:&jsonParsingError];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can we draw the routes between two locations in MapView using the iOS
How can I make a multiline UILabel in interface builder for iOS? I tried
I am using JWPlayer for HTML5 video and curious about when iOS devices can
Using the Facebook iOS SDK I can display a dialog with apprequests and send
I'm a novice in iOS developing, and have some problems with understanding web service
Can anyone help me with SQLite query in my iOS app? I want to
How to parse a a JSON string in iOS app? Using SBJSON. Running the
How can I install the iPhone OS 3 SDK beside the iOS 4 SDK?
How can I programmatically scroll a UIWebView in Objective-C (iOS)? The only solution I
Can anyone let me know what the following error means in iOS Objective-C: Terminating

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.