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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:56:09+00:00 2026-06-06T07:56:09+00:00

So i am trying to make an http request using ASIHTTPRequest class , to

  • 0

So i am trying to make an http request using ASIHTTPRequest class , to send a json file to my server. I was given an android code which is functional and was asked to convert it to iOS code.
I cant understand how to add headers on my request.The android code looks something like this :

private static final String CONTENT_TYPE = "Content-Type";
private static final String JSON_CONTENT_TYPE = "application/json; charset=utf-8";

and then :

request.addHeader(CONTENT_TYPE, JSON_CONTENT_TYPE);

On iOS i figured out that the code is something like this :

[request addRequestHeader:@"Content-Type" value:@"Content-Type"];
[request addRequestHeader:@"Json-Content-Type" value:@"application/json; charset=utf-8"];

BUT i got a bit confused , cause on android the request seems to be paired and on iOS the requestHeaders are individually stated. Is this a problem? Should they be paired too on iOS. Am i missing something here? Thank you for reading my post 😀

  • 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-06-06T07:56:13+00:00Added an answer on June 6, 2026 at 7:56 am

    What you want is

    [request addRequestHeader:@"Content-Type" value:@"application/json; charset=utf-8"];
    

    in the android example, they are just declaring two variables for the header values, they could had simply done something like

    request.addHeader("Content-Type", "application/json; charset=utf-8");
    

    which would have had the same effect, so you just need the one line i mentioned above.

    also: ASIHTTPREQUEST does not get developed any more (see headline here), so consider using another library for something like this, like AFNetworking

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

Sidebar

Related Questions

I trying to make a HTTP request and parse JSON using Stig's JSON Library.
I'm trying to use a java.net.HttpURLConnection to make an HTTP request to a server.
I'm trying to make an HTTP GET request using the jQuery get() function, but
I'm trying to make an HTTP Get request using JQuery, but I get an
I am trying to make a get http request using jquery getJSON function. I
I am trying to make a simple request using http.get. But I need to
I'm trying to figure out how make a basic GET request using Network.HTTP.simpleHTTP that
I am trying to send an HTTP request with the contents of a file
I am trying to make an HTTP request in Python 2.6.4, using the urllib
I'm trying to make an asynchronous HTTP GET request using Webclient, however, the registered

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.