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 6476721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:51:36+00:00 2026-05-25T06:51:36+00:00

How to send a HTTP request to a web service using Objective-C ? I

  • 0

How to send a HTTP request to a web service using Objective-C ? I need to fetch some data from my MySQL DB, so I need to send the request so I could fetch the data.

  • 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-25T06:51:37+00:00Added an answer on May 25, 2026 at 6:51 am

    Edit, because this is a popular question and time keeps going on.
    In the meantime Apple introduced NSJSONSerialization. Have a look a the docs: https://developer.apple.com/documentation/foundation/jsonserialization
    Only if you need to create code for iOS earlier than 5.0 you may want to use the json-framwork as mentioned below.

    Besides that, the following original answer is still valid:

    Assuming that you exchange your data in JSON, you may be interested in reading this.
    http://iosdevelopertips.com/cocoa/json-framework-for-iphone-part-2.html

    However, the first part of that article answers your more general question on how to receive data from a web server/service:

    - (NSString *)stringWithUrl:(NSURL *)url
    {
        NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url
                                                        cachePolicy:NSURLRequestReturnCacheDataElseLoad
                                                        timeoutInterval:30];
            // Fetch the JSON response
        NSData *urlData;
        NSURLResponse *response;
        NSError *error;
    
        // Make synchronous request
        urlData = [NSURLConnection sendSynchronousRequest:urlRequest
                                            returningResponse:&response
                                                        error:&error];
    
        // Construct a String around the Data from the response
        return [[NSString alloc] initWithData:urlData encoding:NSUTF8StringEncoding];
    }
    

    This is a simple example of a http request and surely good enough for your next steps.
    This method is given a URL and it returns the data sent by the server in an NSString.

    Once that is working properly you will like to avoid that your app freezes while the request is “on the air”.
    You can fix that by asynchronous requests. Google or the search on stackoverflow will provide you with links to examples and tutorials about that. But I suggest to go from here first, although this may not be the final solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wish to send a HTTP request to a remote web service using the
I'm using curl to make php send an http request to some website somewhere
when using http post with flash that send ip address request from client computer
I have a WSDL web service http://portal.strongtech.com/i/services/ivos?wsdl and I want to send request to
I'm having some problems understanding how to send a request to a web service
How to send an http request with either post/get method using javascript as an
I need to call a web service from my classic ASP website. I have
I'm trying to send a simple POST request to a REST web service and
I am trying to send a request to a web service. The wsdl can
I am trying to send an HTTP request with the contents of a file

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.